jquery修改获取radio的选中项
<input id="txtBeginDate" onclick="$('#divDate').css({'top':$('#txtBeginDate').offset().top+'px','left':$('#txtBeginDate').offset().left+'px'})" style="width:170px;padding:7px 10px;border:1px solid #ccc;margin-right:10px;"/>
<label><input type="radio" name="sotype" value="0" checked/>商城</label>
<label><input type="radio" name="sotype" value="1" />团购</label>
<label><input type="radio" name="sotype" value="2" />行业</label>
<button type="button" name="appidsubmit" onclick="chaxun()" value="true" class="btnGreen vm" ><strong>查询</strong></button>
<script>
$(document).ready(function(){
var type = 1;
if(type==1){
$('input[name="sotype"]:eq(1)').attr("checked",'checked');
}else if(type==2){
$('input[name="sotype"]:eq(2)').attr("checked",'checked');
}
});
</script>
$('input[name="sotype"]:checked').val();//获取选中的值
jquery修改获取radio的选中项的更多相关文章
- jquery:获取checked复选框的问题
jquery:获取checked复选框的问题 功能描述:要完成一个全选的功能,但总是获取不到复选框的被选中的个数,究其原因,是Jquery中length和checked使用不当所造成的. // 获取所 ...
- WPF学习笔记:获取ListBox的选中项
有代码有J8: UI <UserControl x:Class="UnitViews.UserListUV" xmlns="http://schemas.micro ...
- jquery怎么获取radio选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jquery中获取radio选中值的正确写法
错误写法: //只在IE下有作用,其他浏览器均获取的为第一个单选框的值 $('input[type=radio]').val(); 正确写法为: //兼容所有浏览器写法 $('input[type=r ...
- 获取单个checkbox选中项
1.获取单个checkbox选中项(三种写法)$("input:checkbox:checked").val()或者$("input:[type='checkbox']: ...
- 通过js获取DropDownList的选中项
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> &l ...
- jQuery和js获取select元素的选中项value?
1.jQuery方式获取:$("#test").val(); 2.js方式获取:document.getElementById("test").value;
- jquery 获取radio选中的值
如下案例:常用方法 1.获取选中值,三种方法都可以: $('input:radio:checked').val(): $("input[type='radio']:checked" ...
- jQuery获取Radio选择的Value值||两个select之间option的互相添加操作(jquery实现)
jQuery获取Radio选择的Value值: 1. $("input[name='radio_name'][checked]").val(); //选择被选中Radio的Val ...
随机推荐
- VBA调试利器debug.print
作者:iamlaosong 百度一下.非常easy找到debug.print解释和使用介绍.事实上非常简单.就是将代码运行结果显示在"马上窗体"中,但不影响程序运行.VBA程序调试 ...
- 24.Node.js Stream(流)
转自:http://www.runoob.com/nodejs/nodejs-stream.html Stream 是一个抽象接口,Node 中有很多对象实现了这个接口.例如,对http 服务器发起请 ...
- 8.Maven之(八)约定优于配置
转自:“https://blog.csdn.net/qq_25460531/article/details/79423961” maven的配置文件看似很复杂,其实只需要根据项目的实际背景,设置个别的 ...
- js面向对象3-继承
一.了解继承 首先我们一起了解下js中继承,其实继承就是后辈继承前辈的属性和方法. 二.继承的方法 从父类继承属性和方法 这是对象冒充的方法,模仿java的继承方法.实现的原理是,通过改变父类的执行 ...
- 关于Webpack详述系列文章 (第四篇)
1. webpack基本概念 Entry:入口,Webpack 执行构建的第一步将从 Entry 开始,可抽象成输入.Module:模块,在 Webpack 里一切皆模块,一个模块对应着一个文件.We ...
- 前端上传文件 后端PHP获取文件
<body> <form action="03-post-file.php" method="post" enctype="mult ...
- C Tricks(十八)—— 整数绝对值的实现
为正还是为负:(对 int 类型而言,第一位为符号位,其余为数值,则右移 31 位,再与 1 求与) 如果为正 ⇒ 返回原值 如果为负 ⇒ 对其二进制形式各位取反 + 1 int abs(int x) ...
- 开发板 Linux驱动视频 驱动是什么
内存管理单元很重要. linux把设备看成文件,(open,read,write,ioctrl,close)主要写这几个函数. 哈弗结构,取指令和取数据同时进行. arm处理器体系架构以及发展方向 单 ...
- ASP.NET Core 2.2 十九. 你扔过来个json,我怎么接
原文:ASP.NET Core 2.2 十九. 你扔过来个json,我怎么接 前文说道了Action的激活,这里有个关键的操作就是Action参数的映射与模型绑定,这里即涉及到简单的string.in ...
- 微信小程序图片使用示例
小程序官方API:https://developers.weixin.qq.com/miniprogram/dev/component/image.html 1:加载本地文件夹图片 <image ...