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();//获取选中的值

时间: 2024-08-02 23:31:48

jquery修改获取radio的选中项的相关文章

如何动态修改下拉列表的默认选中项

两种方法,第一种嵌入java代码:原理是首先获取需要选中项,然后用java代码控制那个标签内需要添加selected,其中Wish是放在request中的一个对象,仅此而已 <select name="wish.visible"> <%int visible=((Wish)request.getAttribute("wish")).getVisible(); %> <option value="1" <%if(

通过js获取DropDownList的选中项

1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head runat="server"> 3 <title></title> 4 <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> 5 <script t

JQuery 之 获取 radio选中值,select选中值

以下Jquery代码适query1.4版本以上. Radio 1.获取选中值,三种方法都可以: $('input:radio:checked').val(): $("input[type='radio']:checked").val(); $("input[name='rd']:checked").val(); 2.设置第一个Radio为选中值: $('input:radio:first').attr('checked', 'checked'); 或者 $('inp

jquery怎么获取radio的值

使用jquery获取radio的值,最重要的是掌握jquery选择器的使用,在一个表单中我们通常是要获取被选中的那个radio 项的值,所以要加checked来筛选,比如有以下的一些radio项: 1.<input type="radio" name="testradio" value="jquery获取radio的值" />jquery获取radio的值 2.<input type="radio" name

jquery怎么获取radio选中的值

<!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><meta http-equiv="Content-Typ

获取单个checkbox选中项

1.获取单个checkbox选中项(三种写法)$("input:checkbox:checked").val()或者$("input:[type='checkbox']:checked").val();或者$("input:[name='ck']:checked").val(); 2. 获取多个checkbox选中项$('input:checkbox').each(function() {        if ($(this).attr('che

select元素的各种jquery修改获取添加方法

< select  id =  "sel" > < option  value = "1" >1</ option > < option  value = "2" >2</ option > < option  value = "3" >3</ option > </ select > //取得select选中的值: var opt

在WPF的MVVM框架中获取下拉选择列表中的选中项

文章概述: 本演示介绍如何在WPF的MVVM框架中,通过数据绑定的方式获取下拉列表中的选中项.程序运行后的效果如下图所示: 相关下载(代码.屏幕录像):http://pan.baidu.com/s/1sjwN357 在线播放:http://v.youku.com/v_show/id_XODA5OTYzMDU2.html 温馨提示:如果屏幕录像和代码不能正常下载,可站内留言,或发邮件到[email protected] XAML代码如下所示: <Window x:Class="Demo02E

jquery获取radio值

单选组radio: $("input[@type=radio][@checked]").val(); 单选组 radio: $("input[@type=radio]").attr("checked",'2');//设置value=2的项目为当前选中项 获取一组radio被选中项的值var item = $('input[@name=items][@checked]').val(); radio单选组的第二个元素为当前选中值$('input[@n