如何确定下拉列表是否有可供选择的选项? [英] How to tell if a drop down has options to select?
本文介绍了如何确定下拉列表是否有可供选择的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定下拉列表是否有可供选择的选项?
How to tell if a drop down has options to select?
推荐答案
var hasOptions = !!$('#theSelect option').filter(function() { return !this.disabled; }).length;
也许?这会查找< option>
未禁用的元素。
maybe? This looks for <option>
elements that are not disabled.
这篇关于如何确定下拉列表是否有可供选择的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文