引用$(this).parent,类名为'x'

d-_*_*_-b 20 jquery parent

jQuery中,我怎么可以参考的父$(this)元素用class'abc'

j08*_*691 40

像这样:

$(this).parents('.abc');
Run Code Online (Sandbox Code Playgroud)

要么

$(this).parent('.abc');
Run Code Online (Sandbox Code Playgroud)

要么

$(this).closest('.abc');
Run Code Online (Sandbox Code Playgroud)

.parent()并且.parents()类似,.parent()只是在DOM树中仅向上移动一级.