码迷,mamicode.com
首页 > Web开发 > 详细

jquery修改获取radio的选中项

时间:2016-05-07 12:56:03      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

<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的选中项

标签:

原文地址:http://www.cnblogs.com/zonglonglong/p/5467845.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!