单个按钮

<div id="wrap">
<input type="radio" name="payMethod" value="1" />支付宝
<input type="radio" name="payMethod" value="2" />财务通
</div>
  
  获取一组单选按钮对象:var obj_payPlatform = $('#wrap input[name="payMethod"]');
  获取被选中按钮的值 :var val_payPlatform = $('#wrap input[name="payMethod"]:checked ').val();

多个按钮

  1. 创建Html元素

    <div class="box">
    <span>点击按钮获取checkbox的选中值:</span><br>
    <div class="content">
       <input type='checkbox' name='message' value='1'/>发送短信
           <input type='checkbox' name='message' value='2'/>发送邮件
    </div>
    <input type="button" value="提交">
    </div>
  2. 设置css样式

    div.box{width:300px;padding:20px;margin:20px;border:4px dashed #ccc;}
    div.box>span{color:#999;font-style:italic;}
    div.content{width:250px;margin:10px 0;padding:20px;border:2px solid #ff6666;}
  3. 编写jquery代码

    $(function(){ 
    $("input:button").click(function() {
    text = $("input:checkbox[name='message']:checked").map(function(index,elem) {
    return $(elem).val();
    }).get().join(',');
    alert("选中的checkbox的值为:"+text);
    });
    });

利用jquery获取html中被选中的input的值的更多相关文章

  1. jQuery获取循环中的选中单选按钮radio的值

    1.<input type="radio" name="testradio" value="jquery获取radio的值" /> ...

  2. JS动态获取select中被选中的option的值,并在控制台输出

    生活城市: <select id="province"> <option>河南省</option> <option>黑龙江省< ...

  3. jQuery获取复选框选中的每一个值

    $('input[name="serviceMode"]:checked').each(function(){ this.attr('value') });

  4. Js/Jquery获取iframe中的元素

    转载: Js/Jquery获取iframe中的元素 - - ITeye技术网站http://java-my-life.iteye.com/blog/1275205 在web开发中,经常会用到ifram ...

  5. js,jquery获取下拉框选中的option

    js获取select选中的值: var sel=document.getElementById("select1"); var index = sel.selectedIndex; ...

  6. 十九、利用OGNL获取ValueStack中:根栈和contextMap中的数据

    利用OGNL获取ValueStack中:根栈和contextMap中的数据 原则:OGNL表达式如果以#开头,访问的contextMap中的数据 如果不以#开头,是访问的根栈中的对象的属性(List集 ...

  7. 使用jquery获取网页中图片的高度——解惑

    jQuery获取网页中图片的高度 使用jquery获取网页中图片的高度其实很简单,有两种常用的方法都可以打到我们的目的 $("img").whith();(返回纯数字) $(&qu ...

  8. 利用POI获取Excel中图片和图片位置

    利用POI获取Excel中图片和图片位置(支持excel2003or2007多sheet) 转自:http://blog.csdn.net/delongcpp/article/details/8833 ...

  9. label标签利用jquery获取值得方式为$("#message").html()

    label标签利用jquery获取值的方式为$("#message").text(), 赋值的方式为:$("message").html("北京欢迎你 ...

随机推荐

  1. 简单 常用的git命令

    常用的git命令 git pull  获取最新 git add . 提交所有 git commit  -m “我的注释” git status 查看状态 git push origin master ...

  2. Photoshop教您快速的制作标准一寸证件照教程

    Photoshop教您快速的制作标准一寸证件照教程 对急需证件照的朋友,只要有一部相机,有电脑安装了PS软件,就可很快自己完成一寸照片的制作. 首先将相机卡里的照片存放在电脑硬盘里: 打开PS图片处理 ...

  3. Windows Phone 8 MVVM

    Why? 1 reason MVVM works really well with XAML based applications is because of the powerful XAML bi ...

  4. 【腾讯云】腾讯云服务器搭建ftp服务器

    一.硬件描述 1.1 云服务器:腾讯云 云主机 操作系统:Ubuntu Server 14.04.1 LTS 32位 CPU:1核 内存:1GB 系统盘:20GB(本地磁盘) 数据盘:0GB 公网带宽 ...

  5. 【android design】android常用设计资源

    一.概述 大部分程序员擅长开发,但是对于设计却知之甚少.这直接导致,程序员在初期开发出来的应用(大多为兴趣或实用导向)中看不中用.因此,有必要搜集整合一些设计资源,这样既能减轻程序员在设计上所耗费的时 ...

  6. [CareerCup] 15.1 Renting Apartment 租房

    Write a SQL query to get a list of tenants who are renting more than one apartment. -- TABLE Apartme ...

  7. win7 、win10连接l2tpvpn

    win7:  修改vpn连接选项: win10: 参考连接: http://service.njaf.gov.cn/26970/26971/201510/t20151024_3621861.html ...

  8. linux安装memcached及memcache扩展

    一.安装libevent函数库 下载地址:http://libevent.org 默认被安装到:/usr/local/lib目录下 安装memcached之前需要先安装libevent函数库. 可以通 ...

  9. HDU3874 /HDU3333 树状数组 区间求不重复数和

    Necklace Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total S ...

  10. 判断pc端还是移动,并给移动加上其它的样式文件方法

      所有移动端PC端 按 640 进行排版 body, html { width: %; height: %; overflow: hidden; background-color: #; } bod ...