Marco Song Marco Song - 5 months ago 44
Javascript Question

JQuery: fadeToggle() works in a wrong way

I have two checkboxes with id

'check1' , 'check2'

two table columns with class

'column1', 'column2'


In js file

$(document).ready(function() {

$('#check1').change(function() {

$('#check2').change(function() {

When check1 is checked column shows, then hides when unchecked.
The problem is when check2 is checked column hides, and show when unchecked.

They are code in the same way but works in different way.
What causes the problem, how to fix it? Thanks.


Try this alternative:

    if($(this).is(':checked')) {

    } else {