I'm trying to extend all dom elements so i can get and remove their children. The function is below (works in FF and Chrome). Is there an equivalent in IE7 to extend the base dom object?
if (!Element.get) {
Element.prototype.get = function(id) {
for (var i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i].id == id) {
return this.childNodes[i];
}
if (this.childNodes[i].childNodes.length) {
var ret = this.childNodes[i].get(id);
if (ret != null) {
return ret;
}
}
}
return null;
}
}
Element.prototype.removeChildren = function() {
removeChildren(this);
}
Thanks!