Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-16-2006, 04:45 PM   PM User | #1
arianhojat
New Coder

 
Join Date: Aug 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
arianhojat is an unknown quantity at this point
FireFox removeAttribute doesnt work

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>
Attached Files
File Type: zip removeAttributeTest.zip (597 Bytes, 128 views)
arianhojat is offline   Reply With Quote
Old 05-16-2006, 05:09 PM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Last edited by Kor; 05-16-2006 at 08:33 PM..
Kor is offline   Reply With Quote
Old 05-16-2006, 05:34 PM   PM User | #3
arianhojat
New Coder

 
Join Date: Aug 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
arianhojat is an unknown quantity at this point


THANX
arianhojat is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:13 PM.


Advertisement
Log in to turn off these ads.