Few days ago, I was recalling my Java script skill. I was generating Grid using java script script. Instead of using Display property (’none’ or ‘block’) to show or hide the control, I was creating and removing element each time. Creating element is not a big deal. However the script for removing element is different in IE and Firefox.
In IE, we can remove the element using, however this will not work in Firefox.
{
if(Node1.childNodes[i].id == “Child”)
{
Node1.removeChild(Node1.childNodes[i]);
}
}Happy Programming !
Naimish R. Dave
In IE, we can remove the element using, however this will not work in Firefox.
document.getElementById(“ControlID”).removeNode(true);In Firefox, you have to use,
var Node1 = document.getElementById(“ParentControlID”);Below is the sample code for the same.
Node1.removeChild(Node1.childNodes[0]);
var Node1 = document.getElementById(“Parent”);for(var i = 0; i <>
var len
= Node1.childNodes.length;
{
if(Node1.childNodes[i].id == “Child”)
{
Node1.removeChild(Node1.childNodes[i]);
}
}Happy Programming !
Naimish R. Dave
Comments