octothorp
05-28-2002, 07:24 PM
ok, this probably ranks as the stupidist question I've asked on here yet. A list of attributes is an array, right? So I should be able to delete an attribute using 'splice', right? If there is an easier way of deleting an attribute, please let me know.
So anyway, I write this code, which is supposed to iterate through a list of attributes, find the one that is to be delete, and deletes it. It does these first two steps, but I can't delete my freakin' attributes!
var count = 0;
//iterate through attributes
for (var prop in nodeRef.attributes) {
//find attribute that matches the attribute to be deleted
if (prop == attName) {
//delete the attribute
nodeRef.attributes.splice(count, 1);
}
count++;
}
Any help is regards to what I'm doing wrong would be greatly appreciated.
#
So anyway, I write this code, which is supposed to iterate through a list of attributes, find the one that is to be delete, and deletes it. It does these first two steps, but I can't delete my freakin' attributes!
var count = 0;
//iterate through attributes
for (var prop in nodeRef.attributes) {
//find attribute that matches the attribute to be deleted
if (prop == attName) {
//delete the attribute
nodeRef.attributes.splice(count, 1);
}
count++;
}
Any help is regards to what I'm doing wrong would be greatly appreciated.
#