Modifying an element name

Discussion in 'Javascript' started by El Diablo, Feb 8, 2004.

  1. El Diablo

    El Diablo Guest

    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.
     
    El Diablo, Feb 8, 2004
    #1
    1. Advertisements

  2. 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/
     
    Martin Honnen, Feb 8, 2004
    #2
    1. Advertisements

  3. El Diablo

    El Diablo Guest

    Yes it is IE. bummer.

    "Martin Honnen" <> wrote in message
    news:40262bd3$...
    >
    >
    > 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/
    >
     
    El Diablo, Feb 8, 2004
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Moonbeam66
    Replies:
    2
    Views:
    530
    Moonbeam66
    Jun 7, 2005
  2. Jason Heyes
    Replies:
    11
    Views:
    904
    Jason Heyes
    Feb 9, 2005
  3. Replies:
    9
    Views:
    394
  4. HANM
    Replies:
    2
    Views:
    1,493
    Joseph Kesselman
    Jan 29, 2008
  5. Jeff Kish
    Replies:
    4
    Views:
    1,055
    Martin Honnen
    Oct 30, 2008
  6. nad407
    Replies:
    0
    Views:
    339
    nad407
    Jan 18, 2009
  7. Wind

    Modifying service name and port name in WSDL

    Wind, Apr 1, 2008, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    903
    Tiago Halm
    Apr 1, 2008
  8. Replies:
    6
    Views:
    372
Loading...