未选择第二个下拉值 [英] 2nd dropdown value not selected
本文介绍了未选择第二个下拉值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我删除警报消息时未选择第二个下拉值
如果我在第一个下拉选择后使用javascript alert(),那么将选择值
我的问题是我使用了以下代码
2nd dropdown value not selected when I remove alert message
and if I use javascript alert() after first dropdown selection then value will be selected
My problem is that I have used following code
$.ajax({
cache: false,
type: "POST",
url:Url.Action("controller","view")
data: { QueryId": QueryID
},
success: function (data)
{
document.getElementById(ddlTableName).value = "sometext";
document.getElementById(ddlTableName).onchange();
FillColumnDropDown(document.getElementById(ddlTableName)); //fill 2 nd dropdown
alert("h");
document.getElementById("Select1").text ="MyText"
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Failed to retrieve Master Values.');
}
});
我已经使用过jquery但问题仍未解决
I have already used jquery like but problem still not solved
$("#" + ddlCondition + " option[value='" + data[i].Condition + "']").attr("selected", "selected");
推荐答案
.ajax({
cache: false ,
类型: POST,
url:Url。操作( controller, < span class =code-string> view)
data:{QueryId :QueryID
},
成功:函数(数据)
{
document.getElementById(ddlTableName).value = sometext ;
document.getElementById(ddlTableName).onchange();
FillColumnDropDown(document.getElementById(ddlTableName)); //填写第二个下拉列表
alert( h );
document .getElementById( Select1 )。text = MyText
},
错误:function(xhr,ajaxOptions,thrownError){
alert('无法检索主值。 );
}
});
.ajax({ cache: false, type: "POST", url:Url.Action("controller","view") data: { QueryId": QueryID }, success: function (data) { document.getElementById(ddlTableName).value = "sometext"; document.getElementById(ddlTableName).onchange(); FillColumnDropDown(document.getElementById(ddlTableName)); //fill 2 nd dropdown alert("h"); document.getElementById("Select1").text ="MyText" }, error: function (xhr, ajaxOptions, thrownError) { alert('Failed to retrieve Master Values.'); } });
我已经使用过jquery但问题仍未解决
I have already used jquery like but problem still not solved
( # + ddlCondition + option [value =' + data [ i] .Condition + '])。attr( selected, selected 跨度>);
("#" + ddlCondition + " option[value='" + data[i].Condition + "']").attr("selected", "selected");
这篇关于未选择第二个下拉值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文