JSFiddle - React, Tailwind, and code Playground
HTML
<button id="enable">Enable</button>
<button id="disable">Disable</button>
<br/>
<label>Country</label>
<select id='country' data-changeable=false>
<option selected value="INDIA">India</option>
<option value="USA">United States</option>
<option value="UK">United Kingdom</option>
</select>
JavaScript
var lastSelected = $("#country option:selected");
$("#country").on("change", function () {
if (!$(this).data("changeable")) {
lastSelected.attr("selected", true);
}
});
$("#country").on("click", function () {
lastSelected = $("#country option:selected");
});
$("#enable").on("click", function () {
$("#country").data("changeable", true);
alert("Enabled country selection");
});
$("#disable").on("click", function () {
$("#country").data("changeable", false);
alert("Disabled country selection");
});