[jQuery] Re: Show/Hide divs beginning with a specified string

2008-06-24 Thread Adam
The solution by WoolyNinja works great, with a change of the line: $("div[id^='showhide_']").click(function(){ to: $("img[id^='showhide_']").click(function(){ as it is the image that I wanted to capture the click event for. It could not be done by show/hide classes in a simple way as there will

[jQuery] Re: Show/Hide divs beginning with a specified string

2008-06-24 Thread DaveG
Since you're already using css to show/hide, then why not apply a class to the shown/hidden rows, and select on that instead? Thus, for hidden rows apply the class "hide_row", which will include the css required to hide the row, and apply "show_row" on those rows you want displayed. ~ ~ D

[jQuery] Re: Show/Hide divs beginning with a specified string

2008-06-24 Thread WoolyNinja
I would use the [attribute^=value] selector. Then use substring to get the EngineerShortName. $("div[id^='showhide_']").click(function(){ if(this.id&&this.id.length>0){ var engName=this.id.substring('showhide_'.length); $("div#block_"+engName+" > div").toggle(); } }); On