我有一组单选按钮.选择主要时,主要公司字段将隐藏.我也想在这个时候清除下拉选择.我该怎么做?
I have a set of radio buttons. When primary is selected, the Primary Company field is hidden. I would also like to at this time clear the drop down selection. How can I do this?
<p>
<label>Company Type:</label>
<label for="primary"><input onclick="javascript: $('#sec').hide('slow');" type="radio" runat="server" name="companyType" id="primary" checked />Primary</label>
<label for="secondary"><input onclick="javascript: $('#sec').show('slow');" type="radio" runat="server" name="companyType" id="secondary" />Secondary</label>
<div id="sec">
<label for="primary_company">Primary Company:</label>
<%= Html.DropDownList("primary_company", Model.SelectPrimaryCompanies, "** Select Primary Company **") %>
</div>
</p>
可以像这样清除选择(即选择第一个选项):
You can clear the selection (that is, select the first option) like so:
$("#primary_company").find('option:first')
.attr('selected','selected');
这篇关于单击单选按钮清除下拉选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!