How to check with jquery if select has options and if it doesn't to disable it and show [not items]?
Show activity on this post. if ($("#yourSelect"). find('option[value="value"]'). length === 0){ ... }
Answer: Use the jQuery :selected Selector You can use the jQuery :selected selector in combination with the val() method to find the selected option value in a select box or dropdown list.
The Best Answer isval() === "") { // ... }
One way to do to it:
if ($('#myselect option').length == 0) {     $('#myselect').hide(); } 
                        var $select = $('input:select option'); if(!$select.length )     $select.attr('disabled', true);   Or:
$('select:not(:has(option))').attr('disabled', true); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With