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

Modifying an element name

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


P: n/a


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

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