Answer the question
In order to leave comments, you need to log in
What's my mistake?
Actually the code is jsfiddle.net/d69ne/16
I understand that the error is simple, you must probably set some condition so that the code does not interrupt each other. Tell me what's wrong?
Answer the question
In order to leave comments, you need to log in
Clicking on the .button will always work because you have all the elements wrapped in it. It is better to make the hidden class and add/remove it to nested elements through toggleClass. And remove all show hide
And what exactly should be? One text appears, another disappears. Without a task, it is impossible to understand what works correctly and what does not.
1) maybe get rid of the nesting of internal elements in each other in the DOM, and store the tree in JS? and in the html markup everything is flat
2) keep the structure, but hang the click handlers on h2, thus change to:
$('.button h2')
$('.subcat h2')
$('.subcat2 h2')
, etc. d.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question