Newbie Question:
In jQuery how would I make the browser navigate to the selected drink when selected?
<select name="selDrink" id="selDrink">
<option value="http://coke.com">Coke</option>
<option value="http://pepsi.com">Pepsi</option>
</select>
You will probably want to have a blank
<option>at the top so all the<option>s with actualvalues will be selectable:HTML —
JS —
Note that
.on()is new in jQuery 1.7 and in this case is being used like.bind().Here is a demo: http://jsfiddle.net/Duanx/
Docs for
window.location: https://developer.mozilla.org/en/DOM/window.location