Louis D.
Louis D.

Reputation: 464

Uncaught ReferenceError: fn is not defined

I've made a jQuery function, but it doesn't work. I get this error in the development console: Uncaught ReferenceError: fn is not defined

$(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;
});

Have you an idea?

Upvotes: 0

Views: 3156

Answers (1)

Louis D.
Louis D.

Reputation: 464

I've finally found an answer :

function valueChanged()
{
    if($('#restriciton_cb').is(":checked"))   
        $("#RestrictionDiv").show();
    else
        $("#RestrictionDiv").hide();
}
$(document).ready(function(){
    $('#restriciton_cb').change(function(){
        valueChanged();
    });
    valueChanged();
});

Upvotes: 1

Related Questions