By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,814 Members | 2,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,814 IT Pros & Developers. It's quick & easy.

remove attributes

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a

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

P: n/a
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.