layui单选框事件监听

layui单选框事件监听

layui单选框事件监听_第1张图片

<form class="layui-form dianxuan" action=""style="float: left;margin-top: 7px;margin-right: 20px;">
	  <div class="layui-form-item">
	       <label class="layui-form-label" style="width:100px"><b>显示型号</b></label>
	    <div class="layui-input-block"  id="IsPurchased">
		    <input type="radio" name="sex" value="全部型号" title="全部型号" class="dan" lay-filter="erweima" checked>
		    <input type="radio" name="sex" value="活跃型号" title="活跃型号" class="dan"  lay-filter="erweima">
	    </div>
    </div>
</form>
layui.use('form', function() {
	var form = layui.form;
	form.on('checkbox(switchTest)', function(data) {
		alert("哈哈哈");
		layer.tips('开关checked:' + (this.checked ? 'true' : 'false'), data.othis);
	});
	form.on('radio(erweima)', function(data) {
		alert(data.value); //判断单选框的选中值
		//此处判断
		console.log(data.value)
		
		
		
	});
	form.on('submit(formDemo)', function(data) {
		alert("哈哈哈");
		return false;
	});
	form.render();
});

layui单选框事件监听_第2张图片

你可能感兴趣的:(layui单选框事件监听)