I have a table, and insde the table dynamic inputtextboxes
how can i set the id of textbox "row" + row number
id of first textboxt row0, second one row1 and so on..
I have a table, and insde the table dynamic inputtextboxes
how can i set the id of textbox "row" + row number
id of first textboxt row0, second one row1 and so on..
Jump to PostShow us your code otherwise we're just guessing
Show us your code otherwise we're just guessing
function getId() {
var table = document.getElementById('your-table-id');
var rows = table.getElementsByTagName('tr');
var newId;
if(rows && rows.length) {
var lastRowId = rows[rows.length-1].id;
newId = 'row' + parseInt(lastRowId.substring(lastRowId.indexOf('row')+1, lastRowId.lendth)) + 1;
} else {
newId = 'row0';
}
return newId;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.