Discover more articles. TAGs: ASP.Net, JavaScript… javascript. The value is correctly selected, but you didn’t see it because the plugin hide the real select and show a button with an unordered list, so, if you want that the user see the selected value on the select you can do something like this: To get a list of the selected options, first we need a reference to the select list. MySelect.options[0].value. Now an alert is displayed whenever an option is selected from the drop-down. If the value of the option matches the value that we want to select, we change the selectedIndex of the element and break out of the for loop. The idea is to bind the change event handler to the select box using .change(handler) method. Know how to iterate through all options of a element and the remove() method that removes an option from the element.. How to prevent number input in JavaScript/JQuery. Output: Before click on submit button: After click on submit button: Using DOM querySelector() Method: The querySelector() method is used to return the first element that matches the specified CSS selectors in the document. The following code gets the array of selected options using selectedOptions with the spread syntax (or Array.from()), and then map the