jQuery toggle doesn't work -


i toggle .toggle-item-(number here) .link(number here). @ beginning .toggle-items 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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -