如果只有一个选项可用,如何隐藏选择框。(它是由另一个选择框更新的动态选择框)
发布于 2012-10-12 21:25:23
if($('#select_list>option').length == 1)
$('#select_list').hide();发布于 2012-10-12 21:28:47
将这段代码放在更新下拉菜单中选项的代码末尾(selectid应该是select元素的id ):
if ($('select#selectid option').length == 1)
$('select#selectid option').hide();
else
$('select#selectid option').show();发布于 2012-10-12 21:42:54
var selectBox = document.getElementById("selectBox");
if(selectBox.length == 1)
{
selectBox.style.cssText = "display:none";
}https://stackoverflow.com/questions/12860037
复制相似问题