There are many questions and examples to show / hide, but I can not find the answer.
I have such simple code that is used in several areas on a page.
jQuery(document).ready(function () {
jQuery('#mini-cart').hide();
jQuery('#mini-cart-a').click(function () {
jQuery('#mini-cart').toggle(400);
return false;
});
});
Each show / hide uses its own identifier, so I just group the identifiers like:
jQuery('#show-hide1, #show-hide2').hide();
The problem with this method is that when I click on the show / hid element, all the elements are displayed.
So, I tried something like this, but only the first work, and the second does not work, when I click on it, it does nothing.
jQuery(document).ready(function () {
jQuery('show-hide1, #show-hide2').hide();
jQuery('show-hide1 a, #show-hide2 a').click(function () {
jQuery(this).next().toogle(400);
}
return false;
});
});
There are 4 different areas that I need to show / hide inside the page and really do not want to repeat the same codes 4 times. Thank!
Update:
(Sorry, I cannot use Comment and do not answer my question)
, .
- , div . CMS enviornment, , .
Andy , roXon
Roxon:
http://jsbin.com/ihoqi3/2/
" " (2), , , "", " ", " ".
:
http://jsbin.com/ibayu4
toggleLink.
" " " " "" , , :)
4 , .
p/s, anchor anchor, , JS show/hide div .