Selecting a particular parent in Jquery

Read {count} times since 2020

If you want to select a particular parent div. Then you should use parents() function. If you use parent() function It won’t work. For Example:



If you want to get the id of the main parent which is .main then you should use Jquery code like this:

$("#click").live(‘click’, function(){

The code above will alert the id of the main parent. Try it out yourself.

Show Comments