Reputation: 1969
I have a form within a table. I have 10 inputs within the form. Initially, i'm only showing the first 4 inputs. onClick of the "add more inputs" I want to show another input consecutively. At this time, this jQuery snippet isn't breaking anything else on the page, but it's just not showing the next line.
var inputNumber = 5;
$("#addMore").click(function() {
$("tr:nth-child('+ inputNumber +')").show();
inputNumber++
});
I can't figure out why this would not work...
Upvotes: 0
Views: 51
Reputation: 57105
$('tr:nth-child('+ inputNumber +')').show();
Upvotes: 1
Reputation: 222118
You used double quotes in place of single quotes (or the other way round).
$("tr:nth-child('+ inputNumber +')").show();
should be
$('tr:nth-child('+ inputNumber +')').show();
Upvotes: 1