removeClass doesn't work, addClass does
-
Hey everyone,
I have a problem with jQuery. All the code I type correctly works, except when I call for a “removeClass”.
So far, I have made a tablestructure. On click, the complete first table needs to have an opacity of 0.5. To ensure this, I added a class called “opacity” to the table. In CSS, I wrote that the class has an opacity of 0.5. This works fine: the complete table gets the correct opacity on click.
However, the item that was clicked in the table shouldn’t have that opacity. I tried to remove the class from the specific item, but it doesn’t seem to work. It only works when I try to do this for the complete table.
I hope someone can help me out, here’s the code:
jQuery('.home_tableClick').click(function(){ jQuery('.home_tableEerste').addClass('opacity'); jQuery(this).removeClass('.home_tableEerste'); jQuery('#home_tableFun').load('wp-content/themes/ctaconsulting/tables.php?category='+jQuery(this).attr('id')); jQuery('.initialHidden').hide(); jQuery('.home_tableTweede').show(); });
The topic ‘removeClass doesn't work, addClass does’ is closed to new replies.