...

View Full Version : FireFox removeAttribute doesnt work



arianhojat
05-16-2006, 05:45 PM
hello all,
i have DOM code to remove an attribute and it works in IE but not firefox, i was wondering what i am doing wrong (i guess removeAttribute isnt supported in FF)?

the code looks like this and is also attached if u want to give it a try:

.....
function processClick()
{

var SubmittedBy = document.getElementById('SubmittedBy');
//SubmittedBy.disabled = false;
//SubmittedBy.setAttribute('disabled', 'blah'); // not works
//SubmittedBy.removeAttribute('disabled');
SubmittedBy.removeAttribute('size');
SubmittedBy.removeAttribute('disabled');


}
</script>
<body>

<div onClick="processClick()">Click HEREEEEEEEEEEEEE</div>

<select name="SubmittedBy" disabled="disabled" size="3">
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
<option>TESTTTTTTTTTTTT</option>
</select>

Kor
05-16-2006, 06:09 PM
It is not the removeAttribute() method, it is the improper way you have referenced the object. When using getElementById(id), make sure your object has an id. Your object has only a name, which is not the same thing. IE takes the name as an id, if no id found, but this is an incorrect and silly approach. Give your object an id.

arianhojat
05-16-2006, 06:34 PM
http://mud.mm-a4.yimg.com/image/1237407206

THANX



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum