I'm trying to find the table rows which are dynamically created rows, for example the first rows index shows in the alert with the click event provided when clicked. However when I click any other row after the first one that was dynamically added it comes back empty.
Ultimately, I would like to get the values in the rows associated textbox. first I was simply trying to find the row, Then I was going to move on to the textbox.
HTML
<table class="table table-bordered table-framed" id="seconDTableAdd" style="display:block;height: 100%;">
<tbody>
<tr class="AddBookmarksMenuHere">
<td style="width: 80%;">
<input type='text' id="txtTitle" name="txtTitle[]" style=" width: 300px; padding - top: 1px; height: 20px; font - size: 10px; color: #555555; vertical - align: left; background - color: #ffffff;1px solid #cccccc;border - radius: 1px; " />
<input type="hidden" name="parentType" id="parentType">
<input type="hidden" name="ChildRank" id="parentType">
</td>
<td style="width: 20%;"><a onclick="AddRow()">+</a></td>
</tr>
</tbody>
</table>
Add Row function
function AddRow() {
var i = 2;
var data = "<tr class='AddBookmarksMenuHere'><td style='width:80%;'><input type='text' id='txtTitle" + i + "' name='txtTitle[]' style = ' width: 300px; padding - top: 1px; height: 20px; font - size: 10px; color: #555555; vertical - align: left; background - color: #ffffff;1px solid #cccccc;border - radius: 1px; '/></td>";
data += " <td style='width:20%;'><a class='RemoveThisRow' id='remCF" + i + "' onclick='RemoveRow(" + i + ")'>---</a></td></tr>";
$('table').append(data);
i++;
}
Find 'TableRow'
$('#seconDTableAdd').find('tr').click(function () {
alert('You clicked row ' + ($(this).index() + 1));
});