您好,感谢您的期待。我是javascript / jQuery的新手。我有一个调用SelectOptions()函数的按钮:
以下是按下按钮时该功能的代码:
function SelectOptions() {
var selectedLJP ='';
var selectedFrmn = '';
if (assLocJobPh.length == 1 && assForeman.length == 1) {
selectedLJP = assLocJobPh[0].value;
selectedFrmn = assForeman[0].value;
} else {
selectedLJP = $('#DTCOption').find('[id*=ddlLocJobPhOpt]').val();
selectedFrmn = $('#DTCOption').find('[id*=ddlFrmnOpt]').val();
$('#OptionFormContainer').popup('close');
}
dailyTCOptions.loggedUser = loggedAppUser;
dailyTCOptions.locationJobPhase = selectedLJP;
dailyTCOptions.foreman = selectedFrmn;
dailyTCOptions.Badges = [];
LoadDTCOptionPage();
}
这是HTML /服务器控件:
<form name="OptionForm" method="post">
<p>
<label for="ddlLocJobPhOpt" class="ui-accessible">Location Job Phase</label>
<asp:DropDownList runat="server" ID="ddlLocJobPhOpt" data-mini="true"></asp:DropDownList>
</p>
<p>
<label for="ddlFrmnOpt" class="ui-accessible">Foreman</label>
<asp:DropDownList runat="server" ID="ddlFrmnOpt" data-mini="true"></asp:DropDownList>
</p>
<asp:LinkButton ID="lnkSelectOptions" data-icon="arrow-r" data-iconpos="right" runat="server" data-role="button" Class="custom-btn" data-inline="true" data-theme="c" data-transition="pop" UseSubmitBahavior="false" href="#" data-mini="true" OnClientClick="SelectOptions()">GO</asp:LinkButton>
</form>
目前,当选择go并且某人导航回此弹出窗口时,位置作业阶段选择将返回到默认值,但是在选择第一个下拉列表后填充的foreman将保留在先前值的任何值。
我的目标是将第一个下拉菜单重置为默认值(选择)并清除第二个下拉菜单,如上所示。这是我添加到click事件函数末尾的代码:
selectedLJP.val("0");
selectedFrmn.empty();
但是,当我导航回来时,第二个Dropbox会保持填充状态。如何在按钮单击时清除下拉菜单?