# Tag Info

Here's a one-liner that also plays nice with dodgy user input (say, injecting ]" into the #selectVal field, which would break Andy E's approach. function setSelect() { $("#mySelect").val($("#selectVal").val()).val($("#mySelect").val());$("#selectVal").select(); } Why this works: the first call to \$("#mySelect").val(...) selects the option if it ...