I have a page that's going to have 30 or so id's. I want to toggle them open/closed without having to write the following 28 more times. How would I do this?
First one:
$(document).ready(function(){
$("#one").hide();
$("#hide1").click(function(){
$("#one").slideToggle(2000);
});
});
Second one:
$(document).ready(function(){
$("#two").hide();
$("#hide2").click(function(){
$("#two").slideToggle(2000);
});
});
Would it make more sense to change the id's to something like #toggle1 and then use the starts-with selector ^= or something of the like?