javascript - Get last row of table attribute -


var table = document.getelementbyid(table1); var lastrow = table.rows.length;  var country = lastrow.getelementbyid('country'); country.setattribute('class', "country"+lastrow);    

im pretty new , wondering if possible?

instead of

var country= document.getelementbyid('country'); 

as have other id=country because adding new rows..

edit

i know id unique. cloning last row of course ids same.

an id in html document unique. hence there no need sub-queries in order find elements. instead use document.getelementbyid('country')


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -