I have the following Javascript function that allows me to add a new row to my table:
$(function() {
var $table = $('table.pv-data'),
counter = 1;
$('a.add-author').click(function(event){
event.preventDefault();
counter++;
var newRow =
'<tr>' +
'<td><input type="text" name="id' + counter + '"/></td>' +
'<td><select name="state' + counter + '"/><OPTION value= "persil">Persil</OPTION><OPTION value= "other">Other</OPTION></select></td> ' +
'<td><input type="text" name="longitude' + counter + '"/></td>' +
'<td><input type="text" name="latitude' + counter + '"/></td>' +
'<td><input type="text" name="altitude' + counter + '"/></td>' +
'<td><input type="text" name="module_tilt' + counter + '"/></td>' +
'<td><a href="#" class="remove">remove</a></td>'
'</tr>';
$table.append(newRow);
});
});
Everything is working fine, just the part where I have to select between the options:"Persil" or "Other" is not working. it's not showing the different options.
<select name="state'+counter'">should be correct+after the second to last line of HTML. It's actually harmless here, but it excludes the closing</tr>.