jquery判斷RadioButtonList和RadioButton中是否有選中項(xiàng)示例
更新時(shí)間:2013年09月29日 16:21:55 作者:
用jquery判斷RadioButtonList和RadioButton中是否有選中項(xiàng),下面有個(gè)不錯(cuò)的示例,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:
<pre class="html" name="code"> <%--Body 代碼--%>
<div>
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="A">a</asp:ListItem>
<asp:ListItem Value="B">b</asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButton ID="RadioButton1" GroupName="RBtn" Text="男" runat="server" Checked="true" />
<asp:RadioButton ID="RadioButton2" GroupName="RBtn" Text="女" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Button1_ClientClick()"></asp:Button>
</div></pre>
復(fù)制代碼 代碼如下:
<pre class="csharp" name="code"><%--Head 代碼--%>
<script language="javascript" type="text/javascript" src="js/jquery-1.9.1.js"></script>
<script language="javascript" type="text/javascript">
function Button1_ClientClick()
{
alert($("input[name='RadioButtonList1']:checked").val()); // 若都沒有選中,則彈出“undefined”,若有選中的,則彈出對(duì)應(yīng)的 Value 值
if(document.getElementById("RadioButton1").checked==true) // 若RadioButton1被選中
{
alert($("#RadioButton1:checked").val()); //彈出 RadioButton1
alert($("#RadioButton2:checked").val()); //彈出 undefined
alert($("#RadioButton1:checked").val()=="RadioButton1"); //彈出 true
}
return false; //暫時(shí)不用傳到后臺(tái)
}
</script>
</pre>
您可能感興趣的文章:
- jQuery中的RadioButton,input,CheckBox取值賦值實(shí)現(xiàn)代碼
- asp.net使用jQuery獲取RadioButtonList成員選中內(nèi)容和值示例
- 基于jquery自定義的漂亮單選按鈕RadioButton
- jQuery中RadioButtonList的功能及用法實(shí)例介紹
- Jquery中的CheckBox、RadioButton、DropDownList的取值賦值實(shí)現(xiàn)代碼
- JQuery中對(duì)服務(wù)器控件 DropdownList, RadioButtonList, CheckboxList的操作總結(jié)
- jquery獲取ASP.NET服務(wù)器端控件dropdownlist和radiobuttonlist生成客戶端HTML標(biāo)簽后的value和text值
- jQuery實(shí)現(xiàn) RadioButton做必選校驗(yàn)功能
相關(guān)文章
jQuery實(shí)現(xiàn)table表格信息的展開和縮小功能示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)table表格信息的展開和縮小功能,涉及jQuery事件響應(yīng)及頁(yè)面元素遍歷、屬性修改相關(guān)操作技巧,需要的朋友可以參考下2018-07-07
使用微信內(nèi)置瀏覽器點(diǎn)擊下拉框出現(xiàn)頁(yè)面亂跳轉(zhuǎn)現(xiàn)象(iphone),該怎么辦
這篇文章主要介紹了使用微信內(nèi)置瀏覽器點(diǎn)擊下拉框出現(xiàn)頁(yè)面亂跳轉(zhuǎn)現(xiàn)象(iphone),該怎么辦的相關(guān)資料,需要的朋友可以參考下2016-01-01
jquery分頁(yè)插件jquery.pagination.js使用方法解析
這篇文章主要針對(duì)js分頁(yè)插件jquery.pagination.js使用方法進(jìn)行解析,很實(shí)用的分頁(yè)插件,感興趣的小伙伴們可以參考一下2016-04-04
jquery獲取對(duì)象的方法足以應(yīng)付常見的各種類型的對(duì)象
獲取對(duì)象是比較常見的操作了,因?yàn)橄胍僮饕粋€(gè)對(duì)象之前,一定要先獲取,這是必須的,下面整理了常見對(duì)象的獲取方法,希望對(duì)大家有所幫助2014-05-05
jquery Ajax 實(shí)現(xiàn)加載數(shù)據(jù)前動(dòng)畫效果的示例代碼
本篇文章主要是對(duì)jquery Ajax實(shí)現(xiàn)加載數(shù)據(jù)前動(dòng)畫效果的示例代碼進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-02-02

