Hi,

I am dynamically creating/removing entire rows in a form.

function addNewRow(newId)
{
        var tbody = document.getElementById('list').tBodies[0]; 
    var lastRow = tbody.rows.length - 1; 
    var newId = lastRow;
  
        var row = document.createElement('tr');
        row.setAttribute('id', newId);

Using var lastRow = tbody.rows.length - 1; 
to create the new id does not work for me.

If I have 3 rows
1
2
3
and then I remove row id 2, with the length method, when adding a new row
after that removal I end up with
1
3
3

What is the best method to get the last ID so I have

1
3
4

Thank you.
-- 
View this message in context: 
http://www.nabble.com/Getting-Last-ID-tp25679707s27240p25679707.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to