rodchar said:
hey all,
is there a way to delete or remove and item from the results of
getElementsByTagName?
Its not entirely clear what you actually want to do.
If you mean you want to take the list of items returned by
getElementsByTagName and remove an item from that list then:-
no you can't do that directly. You can copy the list into an array skipping
any that do not conform to come criteria:-
function filterNodeSet(nodeSet, callback)
{
var resultSet = new Array()
for (var i = 0, length = list.length; i < length; i++)
if (callback(nodeSet
)) resultSet.push(nodeSet)
}
var newSet = filterNodeSet(oldSet, function(node) {
return <boolean expression using node here>
})
If you mean can you delete from the DOM a node found via
getElementsByTagName then yes:-
nodeSet.parentNode.removeChild(nodeSet)