javascript - chrome中原生的$和$$是什么方法?
伊谢尔伦
伊谢尔伦 2017-04-11 09:49:29
[JavaScript讨论组]

chrome中原生的$$$是什么方法?哪里可以查到文档?
$$返回的是Array
querySelectorAll返回的是NodeList
getElementsByXXX返回的是HTMLCollection

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(5)
大家讲道理

这个快捷方法最开始是来自于Firebug
http://getfirebug.com/wiki/in...

然后chrome的文档在这儿
https://developers.google.com...


手动更新一下

$(selector) returns the reference to the first DOM element with the specified CSS selector. This function is an alias for the document.querySelector() function.

$$(selector) returns an array of elements that match the given CSS selector. This command is equivalent to calling document.querySelectorAll().

$x(path) returns an array of DOM elements that match the given XPath expression.

黄舟
$ == document.getElementById 
$$ == document.querySelectorAll //$$如图

图1:

图2:

图3:

阿神

$ document.querySelector
$$ document.querySelectorAll

阿神

$ => document.querySelector
$$ => document.querySelectorAll

window.$ = document.querySelector.bind(document)
window.$$ = document.querySelectorAll.bind(document)
怪我咯

Chrome Command Line API Reference 自备梯子
http://getfirebug.com/wiki/in... 免梯子

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号