Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 76102

How to disable dropdown

$
0
0

I have 5 dropdown lists where each has None option whereby when user clicks the None option, the selected None option dropdown will be disabled.

$("#general").change(function() {
  if ($("option:selected", this).val() === "null1")
    $(this).attr("disabled", "true");
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><div class="mt-3 px-3 form-group row"><label for="inputGeneral" class="col-sm-3 mt-2 col-form-label">General</label><select id="general" onchange="valChange(value);" class="col-lg-3 mt-2 px-3 selectpicker" name="usageGeneral" multiple data-live-search="true"><option value="null1">None</option><option>Network Login</option><option>Email</option><option>Integrated Management System</option><option value="other1">Others</option></select><input type="text" placeholder="Others" style="display: none; padding: 0.5%; height: 0.5%;" id="textbox1"></div>

Viewing all articles
Browse latest Browse all 76102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>