Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们如何优化这个选择器:
$(".testClass div#testID:eq(0)")
由于只有一个元素可以具有给定的 ID,因此只需执行
$("#testID")
非常优化的版本: