我做了一个 jQuery 函数,但它不起作用。我在开发控制台中收到此错误:Uncaught ReferenceError:fn未定义
$(document).ready(function(){
$.fn.Restrictions = function () {
if($('#restriciton_cb').checked)
{
$('#RestrictionDiv').fadeIn('slow');
}else{
$('#RestrictionDiv').fadeOut('slow');
}
};
$('#restriciton_cb').change(function(){
fn.Restrictions;
});
fn.Restrictions;
});
你有什么想法吗?
最佳答案
我终于找到答案了:
function valueChanged()
{
if($('#restriciton_cb').is(":checked"))
$("#RestrictionDiv").show();
else
$("#RestrictionDiv").hide();
}
$(document).ready(function(){
$('#restriciton_cb').change(function(){
valueChanged();
});
valueChanged();
});
关于javascript - Uncaught ReferenceError : fn is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32026920/