The below code snippet explains how to get the value of the option from HTML Select dropdown using jQuery
<select id="mySelect">
<option value="1">Yes</option>
<option value="2">No</option>
</select>
<input type="button" id="demo" value = "Demo" />
<script type="text/javascript">
$("#demo").live("click", function () {
//Get text or inner html of the selected option
var selectedText = $("#mySelect option:selected").html();
alert(selectedText);
});
</script>
The button with ID demo is attached with a click event. When the button is clicked the text or inner HTML of the selected option of the HTML Select Dropdown with ID mySelect is fetched and displayed in an alert.
You want to know how to add or remove classes using jQuery ?
Follow this link https://slaford.com/css/jquery-add-and-remove-css-classes/