zoukankan      html  css  js  c++  java
  • jquery修改获取radio的选中项

    <input id="txtBeginDate" onclick="$('#divDate').css({'top':$('#txtBeginDate').offset().top+'px','left':$('#txtBeginDate').offset().left+'px'})" style="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();//获取选中的值

  • 相关阅读:
    vue的单向数据流
    vue的组件基础
    vue v-for的数组改变导致页面不渲染解决方法
    Binary Heap
    Types of Binary Tree
    Merge Sort
    Master Theorem
    Insertion Sort
    Amazon Redshift and Massively Parellel Processing
    Bubble Sort
  • 原文地址:https://www.cnblogs.com/zonglonglong/p/5467845.html
Copyright © 2011-2022 走看看