removeChild() function (js)
Posted: Wed May 23, 2007 10:13 pm
i'm not sure how this function works in javascript. I'm trying to remove an element if it exists
anyone can tell me whats wrong with it?
thanks
edit: umm removeChild removes a child of an elemet right? parentElem.removeChild('childToBeRemoved')?
also since i'm on the subject whats the difference between " " and ' ', when do i use one and when do i use the other?
Code: Select all
structure
<td id=mainFrame><p id="mytxt">this is my p element</p></td>Code: Select all
if(document.getElementById('mytxt')){
alert("Trace In");
var removeThis = document.getElementById('mytxt');
removeThis.removeChild();
}thanks
edit: umm removeChild removes a child of an elemet right? parentElem.removeChild('childToBeRemoved')?
also since i'm on the subject whats the difference between " " and ' ', when do i use one and when do i use the other?