获取RadioButton选中的值
1.RadioButtonList的RepeatDirection="Horizontal"可以设置按扭选项横对齐;
2.获取选中的RadioButton值;
$("#<%=rbA.ClientID %>").find("input[type='radio']:checked").val();
实例:当点击按扭为是时文本框可用,否则不可用
代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
//获取rbA选中的值
var s = $("#<%=rbA.ClientID %>").find("input[type='radio']:checked").val();
//当选【是】时文本框可填,选【否】文本框禁用
$("#<%=rbA.ClientID %>").find("input[type='radio']").click(function () {
var currentCheckedVal = $(this).val();//获取当前选中的值
if (currentCheckedVal == ) {//如果为【是】
$("#<%=txtName.ClientID %>").attr("disabled", "");
}
else if (currentCheckedVal == ) {//选中的是【否】
$("#<%=txtName.ClientID %>").attr("disabled", "disabled");
$("#<%=txtName.ClientID %>").val("");
}
});
});
function funCheck() {
var ss = $("#<%=rbA.ClientID %> input[type='radio']:checked").val();
alert(ss);
};
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButtonList runat="server" ID="rbA" RepeatDirection="Horizontal" style="float:left;">
<asp:ListItem Value="">是</asp:ListItem>
<asp:ListItem Value="" >否</asp:ListItem>
</asp:RadioButtonList><span style="color: #ff0000;float:left;">*</span>
<asp:TextBox ID="txtName" runat="server" ></asp:TextBox>
<asp:Button ID="btnSave" runat="server" Text="保 存" onclick="btnSave_Click" OnClientClick="return funCheck()" />
</div>
</form>
</body>
</html>
获取RadioButton选中的值的更多相关文章
- DWZ-JUI 树形Checkbox组件 无法一次获取所有选中的值的解决方法
UI中 tree Checkbox 组件 在官方文档中提供的oncheck事件中只能够获取当前点击的权限值,而无法获取其他选中的值 <ul class="tree treeFolder ...
- jquery获取select选中的值
http://blog.csdn.net/renzhenhuai/article/details/19569593 误区: 一直以为jquery获取select中option被选中的文本值,是这样写的 ...
- jQuery操作复选框checkbox技巧总结 ---- 设置选中、取消选中、获取被选中的值、判断是否选中等
转载:https://blog.csdn.net/chenchunlin526/article/details/77448168 jQuery操作复选框checkbox技巧总结 --- 设置选中.取消 ...
- jquery怎么获取radio选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery 获取radio选中的值
如下案例:常用方法 1.获取选中值,三种方法都可以: $('input:radio:checked').val(): $("input[type='radio']:checked" ...
- 获取checkboxlist选中的值以及绑定来自之前选中的来自数据库的值
//////ps:一下几句都是一个意思,为的是以后有人搜索关键字的时候能定位到这里///checkboxlist绑定选中值///checkboxlist绑定来之mssql数据的值///checkbox ...
- webform开发经验(一):Asp.Net获取Checkbox选中的值
webform中获取repeat控件列表下的checkbox选中的值: 码农上代码: public static string getSelectedIDs(Repeater Rpt_) { stri ...
- jquery 获取select选中的值
获取选中的名称:$("#selectPinType option:selected").text(); 获取选中的值:$("#selectPinType option:s ...
- checkbox的选中、全选、返选、获取所有选中的值、所有的值、单选全部时父选中
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
随机推荐
- OpenResty编译安装
从下载页 Download下载最新的 OpenResty® 源码包,并且像下面的示例一样将其解压: tar -xzvf openresty-VERSION.tar.gz VERSION 的地方替换成您 ...
- 工具方法 获取远程IP
java-code: public String getRemoteIP(HttpServletRequest request) { String clientIp = request.getHead ...
- Windows Server 2008 安装 10.2.0.5 单实例
需求:Windows Server 2008 安装 10.2.0.5 单实例 原以为非常简单的一次任务,实际却遇到了问题,故记录一下. 1.安装10.2.0.1 2.安装10.2.0.4 3.安装10 ...
- 35.HTML--网页自动跳转 5种方法
网页自动跳转 5种方法 利用HTML标记(META中的REFRESH属性) 用HTML标记,就是用META的REFRESH标记,举例如下: <meta http-equiv=refresh co ...
- Ecshop表结构 order_info
CREATE TABLE IF NOT EXISTS `ecs_order_info` ( `order_id` mediumint(8) unsigned NOT NULL AUTO_INCREM ...
- table可拖拽改变宽度
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- 014-Session服务器状态保持
开始并为Session赋值:Session[“uName”]=“CNYaoMing”;取值:string strName = Session[“uName”].ToString();销毁(取消/退出) ...
- html常用文本标签(转)
内容一<br />内容二 让文本强制换行 内容一内容二 <p>段落一</p><p>段落二</p> 段落标签 段落一 段落二 <b> ...
- finally语句块
finally语句块是搭配着try语句块出现的,也就说必须有try语句块才会有finally语句块,但是并不是try语句块都会搭配有finally语句块出现,我们常见的更多是try...catch.. ...
- 《A Structured Self-Attentive Sentence Embedding》(注意力机制)
Background and Motivation: 现有的处理文本的常规流程第一步就是:Word embedding.也有一些 embedding 的方法是考虑了 phrase 和 sentence ...