我正在尝试将事件监听器附加到复选框,只有当未选中时。 但即使我试图检查它,事件(发射叠加)也会发生。
从下拉列表中选择主机选项
尝试点击专用主机复选框
即使取消选中该复选框,您也会看到叠加层触发。
这是我的代码:
$grpBoxes.fireReveal = function($input) {
//fire overlay only if input is not checked
$input.on('change.overlay', function(e) {
console.log($input.attr('checked'));
if($input.is(':checked')) {
$input.overlay({
onBeforeLoad: function(){
console.log('ready to fire');
$input.addClass('fired');
},
// load it immediately after the construction
load:true,
// disable this for modal dialog-type of overlays
closeOnClick: false
});
}
else {
$input.removeClass('fired');
$input.off('change.overlay');
console.log($input.attr('checked'));
return false;
}
}); // end callback
}; // end fireReveal
这是我的实时代码:http://eetest.netmagicsolutions.com/leadform/ 这是我的完整脚本:http://eetest.netmagicsolutions.com/leadform/js/jquery.leadform.js
我做错了什么?