是否有等效于.closest()的方法,其向下搜索DOM树而不是向上搜索? [英] Is there an equivalent to .closest() that searches down the DOM tree instead of up?

查看:96
本文介绍了是否有等效于.closest()的方法,其向下搜索DOM树而不是向上搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有等效于 .closest()的内容,而不是向上搜索DOM树?

Is there an equivalent to .closest() that searches down the DOM tree instead of up?

推荐答案

closest方法实际上确实在树上搜索(尽管文档说了什么),但我知道您的意思.您想要一个在元素的子元素中进行搜索的元素.根据您的搜索方式:

The closest method does actually search down the tree (despite what the documentation says), but I know what you mean. You want one that searches among the children of the element. Depending on how you want to search:

$('#Id').children('div');

$('#Id').find('div');

这篇关于是否有等效于.closest()的方法,其向下搜索DOM树而不是向上搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆