Selector only selects one (last) of the matched classes.
Hi All,
I have a problem here and I think I am missing something really small..
: I have code to add a row dynamically to a form in my page when an element with class 'addRow' is clicked.
the tables (2 tables in one page) that I want to add the row to have class 'tableAddRow'. The tables are contained in a form.
But for some strange reason the code only adds to the last matched table in the page. This is really annoying. I tried using the $.each selector but nothing helps. my cursing therapy couldn't help here.....
Please help :(
Here is the code:
- $(document).ready(function()
{
$(".addRow").click(function(){
$(".tableAddRow tr:last").clone().insertAfter(".tableAddRow tr:last");
$(".tableAddRow tr:last input").val("");
});
});