单选按钮单击清除下拉选择 [英] Clear dropdown selection on radio button click
本文介绍了单选按钮单击清除下拉选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一组单选按钮。当选择主,主公司字段是隐藏的。我也想在这个时候清除下拉选项。我怎样才能做到这一点?
< P>
<标签>公司类型:< /标签>
<标签=主><输入的onclick =JavaScript的:$('#秒')隐藏('慢');类型=电台=服务器NAME =companyTypeID =主检查/>小学及LT; /标签>
<标签=次要><输入的onclick =JavaScript的:$('#秒)节目(慢);类型=电台=服务器NAME =companyTypeID =次要/>中学及LT; /标签>
< DIV ID =秒>
<标签=primary_company>主要公司:LT; /标签>
<%= Html.DropDownList(primary_company,Model.SelectPrimaryCompanies,**选择主**公司)%GT;
< / DIV> &所述; / P>
解决方案
可以清除选择(即,选择第一个选项),像这样:
$(#primary_company)找到('选项:第一')
.attr('选择','选择');
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');
这篇关于单选按钮单击清除下拉选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文