layui 单选按钮触发事件

单选按钮代码:

    

 

js代码:

 layui.use(['form', 'layedit', 'laydate','layer','element'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,element = layui.element
            ,jQuery = layui.jquery;

        form.on("radio(status)", function (data) {
            var status = data.value;
            console.log(status);
            if (this.value == '0') {
                console.log("出售");
            } else if (this.value == '1') {
                console.log("出租");
            }
        });
    });

 

注意:触发事件被layui接管了,原始的js无法触发

你可能感兴趣的:(layui)