Hi all,
I have a prob regarding javascript.
I have a Div in my web page, Now i get that div by getElementById( "myDiv") and
append it to a dynamic Div created in the javascript file by appendChild(xx) . This works fine for the first time.
But from the next time it will loose the Div in the page and showing null. WHY ??
My code :
Html Page:
JavaScript:
I have a prob regarding javascript.
I have a Div in my web page, Now i get that div by getElementById( "myDiv") and
append it to a dynamic Div created in the javascript file by appendChild(xx) . This works fine for the first time.
But from the next time it will loose the Div in the page and showing null. WHY ??
My code :
Html Page:
Code:
<Html>
<body>
<div id="myDiv"></div>
<input type="Button" onclick="doSMT();" />
</body>
</Html>
Code:
function doSMT()
{
var xx = document.getElementById("myDiv");
var yy=document.createElement("DIV");
yy.appendChild(xx); <== Problem is Here for second run of this function
} (ie, for second click)
Comment