Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I change the name of an ID?

Status
Not open for further replies.

minli98

IS-IT--Management
Aug 30, 2005
178
US
Hi,

I am trying to build a simple dynamic table where users can insert a new row anywhere in the table. Each row has a textfield that are identified using the row number that it is in.

Code:
<tr><td><input id="field1" type="textfield" /></td></tr>
<tr><td><input id="field2" type="textfield" /></td></tr>
<tr><td><input id="field3" type="textfield" /></td></tr>

Say I want to insert between row 2 and 3. Row 3 is going to be pushed down to row 4. So, the textfield id "field3" should be changed to "field4", and the new row will have a textfield with id "field3".

Is this possible to change the name of an id? If not, what alternative way can I try where I can keep track of the textfields in table after insertion?

Thanks.

Min
 
>Is this possible to change the name of an id?
id is read/write property. Just change it once you get to the reference to the input element (obj). Whether the element is created "dynamically" or not just does not matter.
[tt] obj.id="new_id"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top