470,636 Members | 1,634 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Modifying an element name

Hi there,

I'm trying to change the name of an HTML form element using JavaScript but
it doesnt seem to work. It just ignores the attempted change - no errors or
anything. I'm using the tag's id as a referrer:

document.getElementById('elementIdName').name = 'newName';

when I do an alert calling for the value of the form element using the
newName it returns an object not found error. If I use the oldName it works.
What gives? Is what i'm trying even possible?

Many thanks.
Jul 20 '05 #1
2 1000


El Diablo wrote:
I'm trying to change the name of an HTML form element using JavaScript but
it doesnt seem to work. It just ignores the attempted change - no errors or
anything. I'm using the tag's id as a referrer:

document.getElementById('elementIdName').name = 'newName';

when I do an alert calling for the value of the form element using the
newName it returns an object not found error. If I use the oldName it works.
What gives? Is what i'm trying even possible?


Which browser is that? Probably IE. Yes, IE doesn't reflect changes to
the name attribute in the elements collection.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Yes it is IE. bummer.

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:40********@olaf.komtel.net...


El Diablo wrote:
I'm trying to change the name of an HTML form element using JavaScript but it doesnt seem to work. It just ignores the attempted change - no errors or anything. I'm using the tag's id as a referrer:

document.getElementById('elementIdName').name = 'newName';

when I do an alert calling for the value of the form element using the
newName it returns an object not found error. If I use the oldName it works. What gives? Is what i'm trying even possible?


Which browser is that? Probably IE. Yes, IE doesn't reflect changes to
the name attribute in the elements collection.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Logical | last post: by
3 posts views Thread by Jeff J. | last post: by
6 posts views Thread by Prashanth Ellina | last post: by
3 posts views Thread by suresh | last post: by
4 posts views Thread by Mike | last post: by
2 posts views Thread by rob.nikander | last post: by
1 post views Thread by Korara | last post: by
???
reply views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.