Set An Option With A Specific Value From Select Box




Here we consider how to select an option with a specific value from Select Box. Lets start with one example here. Suppose we have a Select Box with ID selectID as shown here.

Set An Option With A Specific Value From Select Box, Set An Option With A Specific Value Using Jquery, Set Option From Select Using jQuery, jQuery set option From Drop Down List, set option From Select Box, Select Box Set Option With A Value, Set An Option With Particular Value Using jQuery, Set option, HTML, PHP

There are three options avaialable on this Select Box. Now we would like to set an option with value google by using jQuery. In jQuery, we can set an option with a value as shown here.

$('#selectID option[value=google]').attr('selected', 'selected');


$('#selectID option[value=google]').prop('selected', 'selected');


Here we find the option in the select box with a value google. And then it attribute selected will be set as selected. By this way, we can set an option with a specific value from Select Box.