aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically Change html name Attribute with delegate function