Wednesday, October 1, 2008

[jQuery] Re: form select...

Thank your for your answers but I don't want to set the value.
What I want to happen is to programmatically change the select into:

BEFORE AFTER
<form> <form>
Select your favorite fruit: Select your favorite fruit:
<select id="fruits"> <select id="fruits">
<option>Apple</option> <option>Apple</option>
<option>Orange</option> <option>Orange</option>
<option>Pineapple</option> <option SELECTED>Pineapple</option>
<----------------------
<option>Banana</option> <option>Banana</option>
</select> </select>
</form> </form>


On Oct 1, 2:50 pm, greenteam003 <c...@eac.bz> wrote:
> You could achieve this by using $('#fruits').val('Banana').
>

No comments: