题图
另外,浏览器控制台和一般嵌入网页的脚本
<script></script>
相比有什么区别?为什么有时候一样的代码表现不一样?
$ 等价于 document.querySelector
$$ 等价于 document.querySelectorAll
$(selector [, startNode])
$(selector) returns the reference to the first DOM element with the specified CSS selector. When called with one argument, this function is an alias for the document.querySelector() function.
$$(selector [, startNode])
$$(selector) returns an array of elements that match the given CSS selector. This command is equivalent to calling document.querySelectorAll().
$ 和 $$ 不是同一个函数
$是jQuery选择器函数,而$$是浏览器控制台(console)中自带的选择器函数
两个不一样
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!