...

View Full Version : removing elements from an objectHTMLCollection



darkmage784
12-03-2005, 07:01 AM
I have an array of input objects, and need to remove some depending on the value of their attributes. When I try inputArray.splice(), however, I am told that that is not a function. How do I remove elements from an objectHTMLCollection?

*MUST work in IE; FF would be nice too (but not necessary)

jkd
12-03-2005, 07:27 AM
HTMLCollection.prototype.splice = Array.prototype.splice

Might actually make it work in Firefox. More generally, however, say:

var collection = [object HTMLCollection] // reference to your collection

// delete the 6th element
collection[5].parentNode.removeChild(collection[5]);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum