对于单个 jQuery 选择器,使用 id 而不是 class 的速度有多快?
How faster is using id instead of class for single jQuery selectors?
我经常使用 .class
到 select 单个 html 元素。然而,这是不正确的。我在某处读到,使用 #id
是使用 jQuery 时的最佳方法。尝试 select 单个元素时,使用 #id
比 .class
快多少?
我经常使用 .class
到 select 单个 html 元素。然而,这是不正确的。我在某处读到,使用 #id
是使用 jQuery 时的最佳方法。尝试 select 单个元素时,使用 #id
比 .class
快多少?