请解释这个jquery选择的内容

Jos*_*ick 2 javascript jquery selector

$(this).parent().find('> ul')
Run Code Online (Sandbox Code Playgroud)

这是什么选择,我真的不明白jquery API在find()函数上说的是什么.

Dav*_*mas 5

它从目标元素($(this))移动到父ul元素,然后选择该父元素的直接子元素(不仅仅是后代元素)的所有元素.实际上,它只是选择当前元素的兄弟元素,相当于:

$(this).siblings('ul');
Run Code Online (Sandbox Code Playgroud)

顺便说一句,jQuery API对于阅读jQuery方法非常棒.要查找有关某些内容的信息,请使用该URL http://api.jquery.com/,然后附加要查找的方法.

因此,如果您想阅读siblings(),URL将变为:http://api.jquery.com/siblings/.

参考文献: