Reputation: 37
Good afternoon! I have a table with rows being added with AJAX calls. These tables have a checkbox button. I want to call another AJAX function on a button click and pass the value of the first TD
in the same row as the selected checkbox into the function. I know how to do most of it, but what I can't figure out is whether there's a way to get a jQuery object of the row in which a selected checkbox resides? Additionally, why can't I use "this" like this?
$("input:checked").each(function(){
var parentRow = $(this).parent();
Thanks!
Upvotes: 0
Views: 366
Reputation: 44740
use .closest()
$("input:checked").each(function(){
var parentRow = $(this).closest('tr');
Upvotes: 1