I know there are multiple ways to select a particular option from a using jQuery:
$select.val(\"someValue\")
$option.attr(\"selected\"
The most used way is $select.val("someValue")
, this is the official method in the documentation for setting a value of any input, so it'll be the most optimized one as well as they hit performance areas.
For #2, yes it satisfies this, for #3...it's short and still makes your intent very explicit.
That being said, the fastest way, if you're setting thousands of select elements is the $select[0].selectedIndex = 1
route...you can't get faster than native DOM properties. When setting the value of one though (unless it has lots of items, in which case again go with .selectedIndex
) the speed should be so far it doesn't matter between any of the three.