Here's a more efficient way to do this:
$(".someButton").on('click', function () { var el = $("select")[0]; el.selectedIndex = Math.min(el.selectedIndex + 1, el.length - 1); });
If you want to stick with jQuery, set option to:
$opt.next().prop('selected', true);
If $opt is the last, .next() will return an empty set, so nothing will change.
source share