"]' ).attr( ' selected' , ' selected' ) To fetch the index (position of the option in DOM tree) of an option by its value, use: We can select text or we can also find the position of a text in a drop down list using option:selected attribute or by using val() method in jQuery.. By using val() method : The val() method is an inbuilt method in jQuery which is used to return or set the value of attributes for the selected elements.. Syntax : $(selector).val(parameter) Getting and setting the value and the text of a selectbox using jQuery is very simple. Because :selected is a jQuery extension and not part of the CSS specification, queries using :selected cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method. See selected option by text in dropdown list is done like $("#numbers option:contains(" + inputText + ")").attr('selected', 'selected'); In this way we can dynamically set the selected option of a drop-down list using JQuery One subtle point I think I’ve discovered about the top voted answers is that even though they correctly change the selected value, they do not update the element that the user sees (only when they click the widget will they see a check next to the updated element).. Chaining a .change() call to the end will also update the UI widget as well. You have a select element, and you need to “select” one of its options based on one of its values. You can use the jQuery :selected selector in combination with the val() method to find the selected option value in a select box or dropdown list. . But we are going to set ” Yellow ” as Selected value by using jQuery. Thank you Best Regards Basha... Varadharaj V: I am sorry if its wrong. Finding an option in a select list by its value works out to be something like this $('option… Note: If no option is selected, the selectedIndex property will return -1. Generally we can specify the HTML Select options selected value by writing HTML Code. Answer: Use the jQuery :selected Selector. Syntax. I’ve researched a lot and get to the following working code: The above code works for a column with no dropdown box. Javascript set selected option by index. To trigger the change event, you can call the .change() or .trigger("change") method after setting the value.. Alternatively, you can use the .prop() method to set the selectedIndex property which reflects the index of the selected