How can I, using jQuery, set the "next" item of an already selected item as "selected."
For example, if I have:
<select>
<option value="1" >Number 1</option>
<option value="2" selected="selected">Number 2</option>
<option value="3" >Number 3</option>
<option value="4" >Number 4</option>
</select>
We can see that "Number 2" is selected, and using jQuery, I'd like to set "Number 3" as selected, and remove the selected "attribute" from "Number 2". I'm assuming I need to use the next selector, but I'm not quite sure how to implement.
Find the row, then
the value you want to select
From version 1.6.1 on, it's advisable to use the method prop for boolean attributes/properties such as selected, readonly, enabled,...
For more info, please refer to to http://blog.jquery.com/2011/05/12/jquery-1-6-1-released/
Working at What is my favorite color?. Click on the arrows.
Check out working code here http://jsbin.com/ipewe/edit