asp.net使用jQuery獲取RadioButtonList成員選中內(nèi)容和值示例
更新時間:2014年01月13日 11:30:01 作者:
這篇文章主要介紹了通過jQuery來獲取RadioButtonList成員內(nèi)容的方法,大家參考使用吧
復(fù)制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.8.2.min.js" type="text/javascript"></script>
<link href="Base.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=rblHobbies.ClientID%> input[type=radio]").bind("change", function () {
if ($(this).val() != "") {
$("#message").text("Text:" + $(this).next().text() + " Value:"+$(this).val());
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin: 100px auto; width: 400px; height: 200px;">
<fieldset style="width: 400px; height: 150px">
<p>
請選擇愛好</p>
<asp:RadioButtonList ID="rblHobbies" runat="server" >
<asp:ListItem Value="1">音樂</asp:ListItem>
<asp:ListItem Value="2">籃球</asp:ListItem>
<asp:ListItem Value="3">美劇</asp:ListItem>
<asp:ListItem Value="4">電影</asp:ListItem>
</asp:RadioButtonList >
</fieldset>
<br />
<div id="message" style="color:blue;"></div>
</div>
</form>
</body>
</html>
您可能感興趣的文章:
- jQuery中select與datalist制作下拉菜單時的區(qū)別淺析
- jquery ajax后臺返回list,前臺用jquery遍歷list的實現(xiàn)
- 基于MVC5和Bootstrap的jQuery TreeView樹形控件(一)之?dāng)?shù)據(jù)支持json字符串、list集合
- jQuery插件datalist實現(xiàn)很好看的input下拉列表
- JqueryMobile動態(tài)生成listView并實現(xiàn)刷新的兩種方法
- CheckBoxList多選樣式j(luò)query、C#獲取選擇項
- Jquery操作下拉框(DropDownList)實現(xiàn)取值賦值
- jQuery接受后臺傳遞的List的實例詳解
相關(guān)文章
獲取Repeter的Item和ItemIndex/CommandArgument實現(xiàn)思路與代碼
Repeater控件,放在ItemTemplate內(nèi)的銨鈕OnClick之后,獲取Repeater的Item,ItemIndex,CommandArgument,CommandName以及綁定的字段值附演示動畫感興趣的朋友可以了解下2013-01-01ASP.NET調(diào)用WebService服務(wù)的方法詳解
這篇文章主要介紹了ASP.NET調(diào)用WebService服務(wù)的方法,較為詳細(xì)的分析了WebService服務(wù)的功能,創(chuàng)建步驟與使用方法,需要的朋友可以參考下2016-05-05ASP.NET Core MVC獲取請求的參數(shù)方法示例
這篇文章主要給大家介紹了關(guān)于ASP.NET Core MVC是如何獲取請求的參數(shù),文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用ASP.NET Core MVC具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05asp.net性能優(yōu)化之使用Redis緩存(入門)
本文主要介紹了asp.net性能優(yōu)化之使用Redis緩存的相關(guān)知識。具有很好的參考價值,下面跟著小編一起來看下吧2017-03-03Asp.net mvc 權(quán)限過濾和單點登錄(禁止重復(fù)登錄)
這篇文章主要介紹了Asp.net mvc 權(quán)限過濾和單點登錄(禁止重復(fù)登錄)的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-12-12