Answers for "if parent class found jquery"

1

jquery if has parent

if ($(this).parents('.last').length) {
    // element has an ancestor element with the class "last"
}
Posted by: Guest on January-27-2021
1

check class exist in element by parent id in jquery

$(this).parent().find('.accordion-body').length == 1; 
or you can use hasClass()
Posted by: Guest on July-09-2020
0

jquery has parent with class

if ($elem.parents('.left').length) {

}
Posted by: Guest on March-08-2021

Code answers related to "if parent class found jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language