获取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= ...
随机推荐
- leetcode 93 复原IP地址
IP地址,分成四段,每段是0-255,按照每段的长度分别为1,2,3下一段长度分别1,2,3再下一段......进行递归遍历,能满足条件的假如res中.比较难想到的就是假如有一段是三位的010是不符合 ...
- (转载)spring单例和多例详解。如何在单例中调用多例对象
spring生成对象默认是单例的.通过scope属性可以更改为多例. <bean id="user" class="modle.User" scope=& ...
- ROSETTA使用技巧随笔--PyMOL实时观测ROSETTA模拟过程中的结构变化
没有梦想的人,就是一只咸鱼,像我,就有一个梦想,就是让蛋白模拟过程变成动画,动起来! 虽然MD中有很多方法可以方模拟过程像动画一样播放出来,但是我一直想在ROSETTA中也找一个这样的功能,这不,我发 ...
- android 调用webview控件,为逆向h5app做准备
activity对应layout文件加入: <WebView android:id="@+id/main_web" android:layout_width="ma ...
- python 定义函数 两个文件调用函数
在def_function.py文件里面写 #coding=utf-8 #定义函数 def hello(): print "hello world" 在test.py里面调用 #c ...
- Python底层库的函数中from __future__ import absolute_import的作用
在查看TensorFlow的底层优化器时候看到from __future__ import absolute_import 查找相关资料后发现 这个语句的意思是加入绝对引用的特征 直白的意思是,比如: ...
- nat123学习笔记
1.NAT123内网映射端口 在无内网路由管理员权限的情况下,需要将内网web应用暴露到公网访问,此时需要用到花生壳或者nat123(两个应用都不是免费的,其中花生壳可以8元认证,以后免费使用,nat ...
- 强化学习--QLearning
1.概述: QLearning基于值函数的方法,不同与policy gradient的方法,Qlearning是预测值函数,通过值函数来选择 值函数最大的action,而policy gradient ...
- Rpgmakermv(16) YEP MainmenuManager
---------------------------------------------------------------------------------------------------- ...
- EasyUI表格DataGrid获取数据的方式
第一种方式:直接返回JSON数据 package com.easyuijson.util; import java.text.SimpleDateFormat; import net.sf.js ...