[jQuery] jQuery next() to find <select><option>
Hello I am using jQuery next() and prev() to navigate inside
<select><option> tags.
problem is I am using <optgroup> too and can't find a way to make it
work
ex:
<select>
<optgroup label="Motion">
<option value="/m01/" >001</option>
<option value="/m02/" >002</option>
<option value="/m03/" selected>003</option>
<optgroup label="illustration">
<option value="/illustration01/" >illustration01</option>
<option value="/illustration02/" >illustration02</option>
</select>
$(document).keydown (function(e) {
if (e.keyCode == 37)
if(n = $('select option:selected').prev().val())
location.href = n;
if (e.keyCode == 39)
if(n = $('select option:selected').next().val())
location.href = n;
});