Modifying an element name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • El Diablo

    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.getEle mentById('eleme ntIdName').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.


  • Martin Honnen

    #2
    Re: Modifying an element name



    El Diablo wrote:
    [color=blue]
    > 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.getEle mentById('eleme ntIdName').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?[/color]

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

    --

    Martin Honnen


    Comment

    • El Diablo

      #3
      Re: Modifying an element name

      Yes it is IE. bummer.

      "Martin Honnen" <mahotrash@yaho o.de> wrote in message
      news:40262bd3$1 @olaf.komtel.ne t...[color=blue]
      >
      >
      > El Diablo wrote:
      >[color=green]
      > > I'm trying to change the name of an HTML form element using JavaScript[/color][/color]
      but[color=blue][color=green]
      > > it doesnt seem to work. It just ignores the attempted change - no errors[/color][/color]
      or[color=blue][color=green]
      > > anything. I'm using the tag's id as a referrer:
      > >
      > > document.getEle mentById('eleme ntIdName').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[/color][/color]
      works.[color=blue][color=green]
      > > What gives? Is what i'm trying even possible?[/color]
      >
      > 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/
      >[/color]


      Comment

      Working...