jquery - Nesting DIV using JavaScript -


i trying load div on button click inside div , on click should create new div inside newly created div. here fiddle:http://jsfiddle.net/lzcw5/4/ , code:

html:

<a href="#" onclick="nestdiv()">generate</a> <div id='x0'>     0 </div> 

javascript:

int level=1; function nestdiv() {     document.getelementbyid('x'+(level-1)).innerhtml="<div id='x"+level+"'>"+level+"</div>";     level++;     if(level==5)         //do somthing } 

i want perform special operation when nesting level reaches 5. not pro @ javascript. please tell me how can achieve this?

in code have change int var , call function variable:

var level=1; nestdiv = function() {     document.getelementbyid('x'+(level-1)).innerhtml="<div id='x"+level+"'>"+level+"</div>";     level++; } 

you can see working here


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -