Why my jquery function is not firing on Firefox

Posted by Cristian Boariu on Stack Overflow See other posts from Stack Overflow or by Cristian Boariu
Published on 2012-06-25T08:34:22Z Indexed on 2012/06/25 9:16 UTC
Read the original article Hit count: 161

Filed under:

I have some trouble with some jquery method (for some checkboxes I want them to fire on checked/unchecked so I can do something then).

This method works perfectly on Chrome and IE but not on latest FF.

jQuery(function () {
    jQuery(':checkbox').change(function () {
        var counter = jQuery('.count').text();
        var thisCheck = jQuery(this);
        if (thisCheck.is(':checked')) {
            counter++;
            //apply green color to the selected row
            jQuery(this).closest('tr').addClass('checked');
        } else {
            counter--;
            //remove green color to the selected row
            jQuery(this).closest('tr').removeClass('checked');
        }
        jQuery('.count').html(counter);

        //enable export button when there are selected emails to be exported
        if (counter > 0) {
            jQuery(".exportButton").removeAttr("disabled", "");
        } else {
            jQuery(".exportButton").attr("disabled", "disabled");
        }
    });
});

Basically it's simply not firing...Even with Debug is not catching the first line (function declare nor other lines too).

If I move this javascript(without function declare) inside jQuery(document).ready(function ($) { all works nice on Firefox too...

Yes, I do use jQuery.noConflict(); before jQuery(document).ready(function ($) {

Do you know why this happens?

© Stack Overflow or respective owner

Related posts about jQuery