gpt4 book ai didi

javascript - $ ('.className > button' ) 和 $ ('.className' ).children ('button' ) 有区别吗?

转载 作者:数据小太阳 更新时间:2023-10-29 04:10:21 25 4
gpt4 key购买 nike

在jQuery中有什么区别

$('.className > button')

$('.className').children('button')

或者这些只是获得相同结果的替代语法?

最佳答案

不是说你最终会得到什么,但第一个可以完全卸载到浏览器的内置 CSS 选择引擎,而第二个需要 jQuery 做更多的工作并涉及更多的对象创建和清理。除非你在一个 mousemove 处理程序中使用很多元素来做这件事,否则这不太重要,即使那样......

关于javascript - $ ('.className > button' ) 和 $ ('.className' ).children ('button' ) 有区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32285378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com