Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safari and removeChild

Status
Not open for further replies.

aforstie

Programmer
Jun 19, 2006
19
US
I call the following function and it appears to remove it from the DOM in Safari. The field it is removing is a password field that has a value of "Password". I add a new node to the DOM that has no value, but when I input a value Safari sends in the the first value "Password" and the value I input.

Any thoughts? (All other browsers only send in the new input value.)

function removeElement() {
var node = document.getElementById("password-span");
node.removeChild(node.childNodes[0]);
}
 
Try using a specific reference to the element you want to remove instead of using childNodes[0], as you could be removing a whitespace node instead of the actual node.

Hope this helps,
Dan


Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
I switched it to this and I am getting the same results. Any other ideas?

// removeElement(document.getElementById("password"));

function removeElement(obj) {
obj.parentNode.removeChild(obj)
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top