What I want to do is check if a drop down has one value or none and then make it read only?
if(){
$('#dropdown').attr("disabled", "disabled");
}
<select class="dropdown" name="dropdown" id="dropdown">
<option value="L6.5">L6.5</option>
</select>
<select class="dropdown" name="dropdown2" id="dropdown2"></select>
<select class="dropinput" name="dropdown3" id="dropdown3">
<option value=""></option>
<option value=""></option>
</select>
I need all top three dropdowns to be disabled
According to HTML specs, the
selecttag in HTML doesn’t have a readonly attribute, only a disabled attribute. Try this it will check for one or no option anddisableit accordingly.Demo