example 我的下拉列表加载了这个: @ Html.EnumDropDownListFor(x => x.field,new {@class =“form-control select”,type =“text”,id =“dropdownlist”})
Javascript:
$("#dropdownlist").on("change",function () {
var asdf= document.getElementById("#dropdownlist");
swal({...},function (isConfirm) {
if (isConfirm) {
//post url
}
else{
if isconfirm false I want to dropdown list selected default value
how ı can
}
答案 0 :(得分:0)
你走了:
$("#dropdownlist").on("change",function () {
var asdf= document.getElementById("#dropdownlist");
swal({...},function (isConfirm) {
if (isConfirm) {
//post url
}
else{
$("#dropdownlist option:first").attr('selected','selected'); //this will do the job for you.
}