Javascript – jQuery single selector vs .find()

javascriptjqueryjquery-selectors

Which is better to use as a performance perspective:

$(".div1 h2, .div1 h3")

or

$(".div1").find("h2, h3")

Best Answer

http://jsperf.com/selector-vs-find-again

selector is faster

(NOTE: made up random html just so it wasn't just those elements on the page)