Difference between find and filter in jquery

懵懂的女人 提交于 2019-11-27 20:05:39

.find() http://api.jquery.com/find/

Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.

Filter, on the other hand, works on the currently matched elements. That's why filter worked but find did not (you needed to look at the current element).

mprabhat

filter will select subset of element from the selected element

find will select descendent/children of selected element

To make it more clear filter will search through all element whereas find will search only in the descendent list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!