How to get the nth child in jquery of a new element
I created a table using jquery:
var tableRow = $("<tr>").append($("<td>").text("one")) .append($("<td>").text("two")) .append($("<td>").text("three")); Now I add it to the table in the document:
$("#table_id").append(tableRow); The next thing I want to do is set the click events on some of the tableRow cells created above. For this purpose I want to use the nth child selector. However, from the documentation, it seems that it can be used with some selectors, for example:
$("ul li:nth-child(2)") But now I need to use :nth-child() for the tableRow variable. How is this possible?
+4
4 answers