Skip to content Skip to sidebar Skip to footer

Reliable Way To Get The "ancestor" Of An Object With A Specific Classname, Using JQuery

I've got a javascript function that gets called on change event of a select form element. So, the 'this' variable in js refers to the select element. This select element is in a t

Solution 1:

You can use closest to find the first matching ancestor:

var filterRow = $(this).closest('.FilterDetailsRow');

Solution 2:


Post a Comment for "Reliable Way To Get The "ancestor" Of An Object With A Specific Classname, Using JQuery"