根据javascript中的第二个下拉列表选项禁用第一个下拉列表中的选项 [英] disable the options in a 1st dropdown list based on the second dropdownlist selction in javascript

查看:85
本文介绍了根据javascript中的第二个下拉列表选项禁用第一个下拉列表中的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要帮助...我有两个html下拉列表第一个是年,第二个是月......我需要帮助java脚本禁用未来(即将到来的)月份选项如果所选年份是当前年份,但如果所选年份是前几年,则启用月份下拉列表中的所有选项....下拉列表正在使用ui-multiselect小部件...但是选项未启用请帮助....



这是我的代码:



< ; script>

function enable(){

var options = document.getElementById(month_selects)。options;

for(var i = 0,iLen = options.length; i< ilen; i ++){>

options [i] .disabled = false;

}

}

< / script>

Hi

I need help...i have two html dropdownlist 1st is years and second is months...i need help with java-script to disable the future(upcoming) months options if the year selected is the current year but if the year selected is of the previous years enable all the options in the month dropdownlist....the dropdownlist is using the ui-multiselect widget...but the options are not being enabled please help....

here is my code:

<script>
function enable() {
var options=document.getElementById("month_selects").options;
for (var i=0, iLen=options.length; i<ilen;i++){>
options[i].disabled = false;
}
}
</script>

推荐答案

请参阅:http://stackoverflow.com/a/11752235 [ ^ ]



对于日期比较或转换,您可以使用 http://momentjs.com/ [ ^ ]



问候..
See this : http://stackoverflow.com/a/11752235[^]

For date comparisons or conversions,you can make use of http://momentjs.com/[^]

Regards..


这篇关于根据javascript中的第二个下拉列表选项禁用第一个下拉列表中的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆