I have a set of dynamic headings and hidden divs with the idea that when the user clicks on a heading it toggles the div underneath to show/hide
the divs all have an id in the form "div_x" where x is dynamically generated
Ive managed to use .each() to loop over all divs that begin with div_ and I can .split the x portion of the id, but I'm unsure how to get jquery to get each heading to show/hide only the relevant other div
$('#[id^=div_]').each(function(){
exploded_id = this.id.split("_");
id = exploded_id[2];
$("#"+this.id).click(function() {
$("#div_body_"+id).slideToggle("slow");
});
});
I'm sure someone will be able to point out the flaw here