jQuery toggle doesn't work -
i toggle .toggle-item-(number here)
.link(number here)
. @ beginning .toggle-item
s closed. 1 toggle item should shown @ same time. every time new toggle item opens other open toggle item should close.
link code here: http://jsfiddle.net/rauqb/
why jquery code not work?
updated marc's code closes others when clicking.
$(document).ready(function() { $('[class^=toggle-item]').hide(); $('[class^=link]').click(function() { var $this = $(this); var x = $this.attr("class"); var classname = '.toggle-item-' + x.replace('link', ''); $(classname ).toggle(); $('[class^=toggle-item]:not('+classname +')').hide(); return false; }); });
Comments
Post a Comment