0

I am trying to get the add/remove row for a table which has multiple input fields in a row. I am able to get the cloning and removing of row.

What I need is to have the unique id name for each cloned input box. in the default row, input fields already has ids so cloned input should have the sequel of existing ids.

For example: default id names are firstname1 and lastname1 second row input field should have firstname2 ans lastname2 respectively. And when a row is removed, row ids should be reordered. For example if I remove 5th row , then 6th row ids should get changed to firstname5 and lastname5

DEMO

Sowmya
  • 26,684
  • 21
  • 96
  • 136
  • 3
    http://stackoverflow.com/questions/10126395/how-to-jquery-clone-and-change-id – Girish Sakhare Nov 23 '15 at 06:41
  • It is definitely a bad idea to give them IDs manually, and then reapply them on item removal. You can give them a class like `firstname` and `lastname`. Then, you will be able to use selector-queries like `firstname:eq(2)` or simply get an array using `getElementsByClassName` and work with it. – Yeldar Kurmangaliyev Nov 23 '15 at 06:42

0 Answers0