I tried using the following code to check if the user has selected a particular option in a single select drop down has been selected, then add a class ... Search jQuery. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. The idea is to select a default value from the list of options in the element. Search. The second one is the text value of the select element. COLOR PICKER. View options. Hold down the control key on Windows or command key on Mac to select multiple options. Get Selected Options from Multiple Select Box. LIKE US. This is optional. Teams. A multiple select box allows a user to select multiple options. Related: Multiple Selections using jQuery Select2 Plug-in with Asp.Net. The selectedIndex is -1 when no action has been taken on the HTML SELECT … Attributes vs Properties¶. The prop() method provides a way to get property values for jQuery 1.6 versions, while the attr() method retrieves the values of attributes. < option value = "5" > Prof If you wanted to get the string "Mr" if the first option was selected (instead of just "1") you would do that in the following way: ... Specifies the text to find jQuery Selectors. The HTML Button has been assigned a jQuery OnClick event handler. Similarly, you can retrieve the selected values from multiple select boxes with a little trick. That way, only elements that actually have that attribute would be selected. To clear all the options from the select use jQuery’s remove() function: $('#example option').remove() Adding new options and getting the currently selected value. The plugin is hosted on SourceForge. We could simply select elements via jQuery with an attribute selector (having the syntax, [attribute="value"]). We can then simply use JavaScript's length property to check if there were any elements that matched like so: The following select box has some options with values, the text value of the selected option will be retrieved from this select element. It is just an example and it might help in some scenarios. The Dropdown CheckList jQuery widget transforms a regular