469,601 Members | 2,406 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,601 developers. It's quick & easy.

remove attributes

I am using IE and I want to remove some attributes on my page before I
delete the rows as a result of what looks like memory leaks in my page.

I understand I can't remove the attributes, but the event handler is
removed.

here is my code:

var row_delete = document.getElementById("Task_Row_"+taskNum);
var obj = row_delete.getElementsByTagName("input");
for ( var i=0; i<obj.length; ++i )
{
var atts = obj[i].attributes;
for (var j=0;j<atts.length;j++)
{
if (atts[j].specified)
{atts[j] = null;}
}
}

I seem to get an error on this statement: atts[j] = null;

Mike

Oct 14 '05 #1
2 4368

mike wrote:
I am using IE and I want to remove some attributes on my page before I
delete the rows as a result of what looks like memory leaks in my page.

I understand I can't remove the attributes, but the event handler is
removed.

here is my code:

var row_delete = document.getElementById("Task_Row_"+taskNum);
var obj = row_delete.getElementsByTagName("input");
for ( var i=0; i<obj.length; ++i )
{
var atts = obj[i].attributes;
for (var j=0;j<atts.length;j++)
{
if (atts[j].specified)
{atts[j] = null;}
}
}

I seem to get an error on this statement: atts[j] = null;

Mike


You have an array of Attr objects. Try using the following:

if(atts[j].specified)
{
atts[j].value = "";
}

But if you're looking for a specific attribute, you should look into
using the getAttribute() method.

Oct 14 '05 #2
atts[j].value = "";

yes that works .... But It still looks like I get memory leaks.
But if you're looking for a specific attribute, you should look into
using the getAttribute() method.


http://www.quirksmode.org/dom/w3c_core.html#attributes shows this as
being incomplete for that method

Oct 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mikael Petterson | last post: by
3 posts views Thread by sam.stamport | last post: by
8 posts views Thread by Gerry Viator | last post: by
reply views Thread by Jonas | last post: by
reply views Thread by Ismail | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.