dangermonkey
asked on
.RemoveChild functioning in IE, throwing a Pointer error in FF
I have a little snippet of code that is throwing an error in Firefox, but functioning fine in IE. Basically, it's a rating system. Once a user rates the item, the rating area needs to be removed. IE does this, but in Firefox I get the following error:
[Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.remo veChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER) " location: "JS frame :: :: jsUpdateHTML :: line 31" data: no]
Can't seem to figure out what is throwing this in FF.
[Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER)
Can't seem to figure out what is throwing this in FF.
var l_dStars = document.getElementById( "dStars" );
for( var l_iCt = 1; l_iCt <= 5; l_iCt++)
l_dStars.removeChild( document.getElementById( "dStar"+l_iCt ) );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much! That worked perfectly!!
var l_dStars = document.getElementById( "dStars" );
for( var l_iCt = 1; l_iCt <= 5; l_iCt++)
deleteNode("dStar"+l_iCt );
function deleteNode(elementId){
var e=document.getElementById(
if(!e)
return;
while( e.hasChildNodes() ) { e.removeChild( e.lastChild ); }
}