jquery set select value
Set the value of the colour select box to green with jquery.
Code
<select id="myField" >
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
<button type="button" onclick="setField()" >Go!</button>
<script>
function setField()
{
$("#myField").val("green")
}
</script>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
<button type="button" onclick="setField()" >Go!</button>
<script>
function setField()
{
$("#myField").val("green")
}
</script>