• jQuery操作radio、checkbox、select示例


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> jQuery操作radio、checkbox、select示例 </title>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
      <script src="http://code.jquery.com/jquery-1.11.1.min.js" ></script>
     </head>
    
     <body>
      <div>
                    <input type="radio" name="radio" id="radio1" value="radio1" />radio1    
                    <input type="radio" name="radio" id="radio2" value="radio2" />radio2    
                    <input type="radio" name="radio" id="radio3" value="radio3" />radio3    
                    <input type="radio" name="radio" id="radio4" value="radio4" />radio4   
                     
                    <br/>
                     
                    <input type="checkbox" name="checkbox" id="checkbox_id1" value="checkbox1" />checkbox1    
                    <input type="checkbox" name="checkbox" id="checkbox_id2" value="checkbox2" />checkbox2    
                    <input type="checkbox" name="checkbox" id="checkbox_id3" value="checkbox3" />checkbox3    
                    <input type="checkbox" name="checkbox" id="checkbox_id4" value="checkbox4" />checkbox4    
                    <input type="checkbox" name="checkbox" id="checkbox_id5" value="checkbox5" />checkbox5    
                     
                    <br/>
                     
                    <select name="select" id="select_id" style=" 100px;">    
                        <option value="select1">select1</option>    
                        <option value="select2">select2</option>    
                        <option value="select3">select3</option>    
                        <option value="select4">select4</option>    
                        <option value="select5">select5</option>    
                        <option value="select6">select6</option>    
                    </select>   
                     
                    <br/>
                     
                    <span onclick="show()">点击</span>
      
      </div>
          <script>
         
                function show()
                { 
                    //jquery获取单选框的值
                    alert($('input[type="radio"][name="radio"]:checked').val());
                 
                    //jquery循环输出选中的值
                    $("input[type=checkbox][name=checkbox]:checked").each(function(){ 
                        alert($(this).val());    
                    });    
                 
                    //jquery获取Select选中项的Value    
                    alert($("#select_id").val());
                 
                    //jquery获取Select选中项的Text               
                    alert($("#select_id :selected").text());    
                }
         
        </script>
     </body>
    </html>
  • 相关阅读:
    Hadoop基础---流量求和MapReduce程序及自定义数据类型
    Hadoop基础---MapReduce及YARN中job提交源码分析(进一步理解Hadoop机制)
    Hadoop基础---MapReduce的几种运行模式(方便调试)
    Hadoop基础---MapReduce实现
    Hadoop基础---RPC框架思想及HDFS源码解析
    Hadoop基础---HDFS的Java客户端编写
    Hadoop的安装(2)---Hadoop配置
    Hadoop的安装(1)---linux基本配置
    第23章 RTX 低功耗之待机模式
    第22章 RTX 低功耗之停机模式
  • 原文地址:https://www.cnblogs.com/yangml/p/3874747.html
Copyright © 2020-2023  润新知