0

I'm trying to update the selected option in a select box using jQuery. My html is as follows:

<select id="selectBox">
    <option value="1">Value 1</option>
    <option value="2">Value 2</option>
    <option value="3">Value 3</option>
    <option value="4">Value 4</option>
</select>

Using jQuery, how can I change the selected option from the default (first option) to the option with value 3 (third option)?

Thanks in advance

iaingscott
  • 37
  • 1
  • 2
  • 4
  • 1
    Duplicate: http://stackoverflow.com/questions/7373058/how-to-change-the-selected-option-of-html-select-element – aurbano Apr 14 '14 at 11:33

1 Answers1

2

Use .val()

$(document).ready(function() {
   $('#selectBox').val('3')
});
Satpal
  • 132,252
  • 13
  • 159
  • 168