What is the jQuery equivalent of querySelector? The only way I've found so far is to select all then pick the first selection:
$(selectorString)[0]
With the above expression, is jQuery smart enough to stop after finding the first match?
Update: @Mutnowski suggested using eq() and first, but after reading the jQuery documentation those two methods seem to have the same drawback: jQuery will first get all matches, then only filter out the first element.
You want .eq(index) to get an index
$("td").eq(2)
$("td:eq(2)")
If you want just the first use .first()
$("tr").first()
$("tr:first")