jQuery 选择器问题

标签 jquery performance jquery-selectors

这样做有什么不同:

$(this).find('.action')

$('.action', this)

性能?如果是的话哪一个更好,为什么?

还有别的吗?

最佳答案

这与 jQuery 文档 (http://api.jquery.com/jQuery/) 没有区别:

Internally, selector context is implemented with the .find() method, so $('span', this) is equivalent to $(this).find('span').

关于jQuery 选择器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7129171/

相关文章:

performance - 大型表上的 SQLite 性能

java - 对大型应用程序进行分析很困难

javascript - jQuery - 从具有相同类的元素中获取不同的值

jquery - 如何在 jQuery 中将值从一个页面传递到另一个页面

javascript - 在用户写入时验证表单输入文本

php - 从 PHP 数组中获取最小值和最大值

javascript - 隐藏 .children 很容易 - 属于 <dt> 的 <dd> 怎么样

javascript - 如何通过 JavaScript 在 Bokeh 中设置输入文本字段的值?

javascript - 无法解析日期参数: Invalid Date issue in Safari and Firefox

css - 在复杂的 jQuery/CSS3 选择器中使用 TILDE