我有5个HTML选择框,它们都填充了相同的数据,因此不是"链式选择".
我想禁用select2直到select1被选中并选择3禁用,直到选择了SELECTS 1和2等.
我的SELECT ID是:
所有SELECTS的默认值是"选择作业"
如果SELECT具有除"选择作业"之外的任何其他值,则行中的下一个SELECT可以变为活动状态.
不确定如何在jQuery中执行此操作
假设除了第一个之外的所有部分都已被禁用:
$("select").change(function() {
if ($(this).val() !== "select job") {
$(this).next("select").prop("disabled", false);
} else {
if(!$(this).index() === 0)
$(this).prop("disabled", true);
$(this).next("select").prop("disabled", true);
}
});?
Run Code Online (Sandbox Code Playgroud)
我通常建议首先阅读http://www.whathaveyoutried.com/的精彩资源,但我正在等待下一班车,所以我需要做点什么来消磨时间(这不是工作).