wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Dynamically Change html name Attribute with delegate function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamically Change html name Attribute with delegate function" Watch "Dynamically Change html name Attribute with delegate function" New topic
Author

Dynamically Change html name Attribute with delegate function

Ramneek Singal
Greenhorn

Joined: Nov 20, 2013
Posts: 6
Hi,

I have the js and the html at the location: http://jsfiddle.net/T9e9Z/2/

It's working fine but i would like to add an additional feature where i need different name attribute for select and input tag eg. like key1, key2 and so on when i click on +?
How i can accomplish that?

I have tried to use something like below but not sure how that works:

var nam = "key"+ counter;
..
counter++
document.getElementsByTagName('select').setAttribute('name', nam);


Complete HTML and JS code below as well:

HTML:



JS:

Ramneek Singal
Greenhorn

Joined: Nov 20, 2013
Posts: 6
A colleague helped with the answer and it is:



Note: For select.key to work you have to add the attribute class in the select tag.

Thanks!

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamically Change html name Attribute with delegate function
 
Similar Threads
Component ID has already been found in the view
Jquery form validation
retrieve check box value rendered dynamically by a javascript
how to take javascript array values in php form
DIV Tag Loading Behavior is Erratic