There is this code that works with checkboxes:

<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script> <script type="text/javascript"> var on_prefix = "chekbox-on"; var off_prefix = "chekbox-off"; $(document).ready(function() { $('.check_f').hide(); $('.check').click(function(){ var index = $('.check').index(this); var imgsrc=$(this).attr('src'); if ($('.check_f').eq(index).attr('checked')) { $(this).attr('src',imgsrc.replace(on_prefix,off_prefix)); $('.check_f').eq(index).removeAttr('checked'); } else { $(this).attr('src',imgsrc.replace(off_prefix,on_prefix)); $('.check_f').eq(index).attr('checked','true'); } }); }); </script> 

Checkbox has the form

 <div class="checks"> <div><img class="check" src="images/1_chekbox-off.png"><input type="checkbox" name="check_del[]" value="бла бла бла" class="check_f" /><span class="centerspan">бла бла бла</span></div> </div> 

But there is one problem in the IE, Mozilla and Opera browsers: the check box works, only twice it cannot be continuously clicked on it. Help solve the problem, Safari and Chrome only works.

    2 answers 2

    And I work in Mozilla.

    • Solved the problem with a newer version of js, thanks for the hint -) - Afimida

    The problem is that double clicking the dblclick event occurs. So try hanging another event:

     $('.check').click(...).dblclick(function(){ $(this).click(); });