remove attributes

M

mike

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.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
 
W

web.dev

mike said:
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.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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top