Bar*_*ney 1 javascript jquery jquery-selectors dom-traversal jquery-traversing
在jQuery中
$('html head').length // 1
Run Code Online (Sandbox Code Playgroud)
和
$('html').find('head').length // 1
Run Code Online (Sandbox Code Playgroud)
和
$('html').find('head').filter('html head').length // 1
Run Code Online (Sandbox Code Playgroud)
但
$('html').find('html head').length // 0
Run Code Online (Sandbox Code Playgroud)
为什么?
因为<html>标签内没有嵌套<html>标签
但:
$('html').find('html, head').length // return 1 here coz comma means 'or'
Run Code Online (Sandbox Code Playgroud)
根据文件:
查找:获取当前匹配元素集中每个元素的后代,由选择器,jQuery对象或元素过滤.
HTML 不是的后代 HTML
| 归档时间: |
|
| 查看次数: |
107 次 |
| 最近记录: |