Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamically Change html name Attribute with delegate function

 
Ramneek Singal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic