Help with using finding dom values using jquery .change function

Hey there,

Best to use delegated events which means you need one listener that can catch events for all rows.
event.target inside the function is the element that triggered the event

$('table').on('change', '.changeStatus', function(event) {
   var $select = $(event.target);

   // how to get id of parent tr
   var tr = $select.closest('tr')[0];
   var id = tr.id;
   var className = tr.className;

   // how to get value of that particular dropdown selected
   var value = $select.val();
   alert(value);
});
1 Like