views:

23

answers:

1

I have an id of the form id = MAIN. When a button is clicked, I want ALL other id's in the dom of the form (MAIN_*) where * is any string to be toggled, so:

$(something).toggle(); // will toggle all id's MAIN_*

How would I do this in the click event of my button?

+1  A: 
$(button).click(function(){
  $("#MAIN *[id^=MAIN_]").toggle();
});
Anpher
maybe im doing something wrong but it doesnt seem to be working. I need all ides of the form MAIN_... to toggle, but MAIN should not toggle.
aeq
looks like removing '#MAIN' from the selector worked
aeq