Dynamically create numbered divs in Javascript + Jquery show/hide
- by Vafello
I would like to create numbered divs (such as eventbox1, eventbox2, etc.) in a loop and then have an option to show and hide them.
for (i=0; i<8; i++) {
var html = '<div id="eventbox"></div>';
content.innerHTML += html;
}
I have also the following code in Jquery UI:
function ShowHide(){
$("#eventbox").animate({"height": "toggle"}, { duration: 1000 });
}
<a onclick="ShowHide(); return false;" href="" id="dialog_link">Show/Hide</a>
I was wondering how to enable show/hide option of each div in turn.