I'm having problems with the counter, the function should add a row to a table but should stop when there are 3 row added. In this case its not stopping
what is wrong in the script ?
thanks for any help
var i=0
function addRowToTable() {
if (i == 3)
{
alert("Er kunnen niet meer groepen worden toegevoegd, neem contact op met de RAB");
return;
}
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow + i;
var row = tbl.insertRow(lastRow);
if (i == 3)
{
alert("Er kunnen niet meer groepen worden toegevoegd, neem contact op met de RAB");
return;
}