2012-06-25 39 views
0

我遇到了一些jquery方法的问题(对于某些复选框,我希望它们在选中/取消选中时触发,以便我可以执行某些操作)。为什么我的jquery函数没有在Firefox上触发

此方法在Chrome和IE上完美工作,但不是最新的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"); 
     } 
    }); 
}); 

基本上它根本就没有开火......即使有调试不捕获第一行(函数声明,也没有其他行)。

如果我提出这个JavaScript(不function申报)内jQuery(document).ready(function ($) {所有的Firefox太工作不错...

是的,我jQuery(document).ready(function ($) {

之前使用jQuery.noConflict();你知道为什么会这样?

回答

0
(function($) { 
    // put your code in here 
})(jQuery); 

试试这个。

+0

您的修正适用于Chrome,但不适用于FF。 –

相关问题