jquery, performance-wise what is faster getElementById or jquery selector?

后端 未结 8 1191
忘掉有多难
忘掉有多难 2020-12-04 15:45

What is better from performance wise document.getElementById(\'elementId\') or $(\'#elementId\') ? How can I calculate the speed by myself?

8条回答
  •  一整个雨季
    2020-12-04 15:53

    Use http://jsperf.com/ if you want to test any kind of performance between jquery and dom but jquery is normaly slower with everything since it is based on the dom.

提交回复
热议问题