<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div>
<label>
<input type="checkbox" value="1">
</label>
<label>
<input type="checkbox" value="2">
</label>
<label>
<input type="checkbox" value="3">
</label>
<label>
<input type="checkbox" value="4">
</label>
<label>
<input type="checkbox" value="5">
</label>
<label>
<input type="checkbox" value="6">
</label>
<label>
<input type="checkbox" value="7">
</label>
<label>
<input type="checkbox" value="8">
</label>
<label>
<input type="checkbox" value="9">
</label>
<label>
<input type="checkbox" value="10">
</label> </div>
<input class="ceshi" type="button" value="确定"> <script>
$(".ceshi").on("click", function(){
var num = $("div label").length;
var zhi = []
for(var i = 0; i < num; i++) {
if ($("div label").eq(i).find("input").is(":checked")) {
var chk = $("div label").eq(i).find("input").val();
zhi.push(chk);
};
}
alert(zhi);
})
</script>
</body>
</html>

作品第一课----获取批量checkbox选中的值的更多相关文章

  1. webform开发经验(一):Asp.Net获取Checkbox选中的值

    webform中获取repeat控件列表下的checkbox选中的值: 码农上代码: public static string getSelectedIDs(Repeater Rpt_) { stri ...

  2. jQuery实现的全选、反选和获取当前所有选中的值功能

    链接: jQuery实现的全选.反选和获取当前所有选中的值功能 <ul id="list"> <li><label><input type ...

  3. CheckBoxList 获取与设置选中的值

    /// <summary> ///CheckBoxListHelper 的摘要说明 ///CheckBoxList获取与设置选中的值 /// </summary> public ...

  4. jquery获取单选button选中的值

    在页面上单选button的代码: <s:iterator value="@com.hljw.cmeav.util.CmeavGlobal@isComMap"> < ...

  5. 获取select标签选中的值

    js获取select标签选中的值 var obj = document.getElementById(”testSelect”); var index = obj.selectedIndex; var ...

  6. js获取select标签选中的值[转]

    var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 va ...

  7. js获取select标签选中的值及文本

    原生js方式: var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // ...

  8. 使用jQuery获取radio/checkbox组的值的代码收集

    <!-- $("document").ready(function(){ $("#btn1").click(function(){ $("[na ...

  9. jquery 获取easyui combobox选中的值、赋值

    jquery easyui combobox 控件支持单选和多选 1.获取选中的值 $('#comboboxlist').combobox('getValue');  //单选时 $('#combob ...

随机推荐

  1. 暑假集训(1)第二弹 -----Catch the cow(Poj3278)

    Description Farmer John has been informed of the location of a fugitive cow and wants to catch her i ...

  2. 深入理解Python中的生成器

    生成器(generator)概念 生成器不会把结果保存在一个系列中,而是保存生成器的状态,在每次进行迭代时返回一个值,直到遇到StopIteration异常结束. 生成器语法 生成器表达式: 通列表解 ...

  3. ubuntu nginx 伪静态 设置

    简单的静态设置 1  vim nginx.conf // 修改nginx配置文件 server { .... root /usr/local/nginx/html; #nginx网站根目录 #下面这个 ...

  4. mysql 查找包含特定名字的表

    SELECT distinct TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME LIKE '%medias%'

  5. linux运维工程师,必须掌握以下几个工具

    本人是linux运维工程师,对这方面有点心得,现在我说说要掌握哪方面的工具吧说到工具,在行外可以说是技能,在行内我们一般称为工具,就是运维必须要掌握的工具.我就大概列出这几方面,这样入门就基本没问题了 ...

  6. jquery上传插件uploadify 报错http error 302 解决方法之一

    前段时间用到jquery上传插件uploadify时,始终出现系统报出 http error 302 的错误. 网上大量搜集信息,基本上都是说session值丢失的问题,根据网友提供的解决方案进行修改 ...

  7. 数据库(MSSQLServer,Oracle,DB2,MySql)常见语句以及问题(续1之拼接字符串)

    上一篇文章http://www.cnblogs.com/valiant1882331/p/4056403.html写的太长了,所以就换了一篇,链接上一节继续 字符串的拼接 MySql中可以使用&quo ...

  8. Checbox的操作含已选、未选及判断代码

    Checbox的操作包括已选.未选.判断等等,下面有个不错的示例,使用jquery完成,感兴趣的朋友可以参考下 $("#chk1").attr("checked" ...

  9. Soy文件生成JS文件 - 一个使用Google soy模板的例子

    1.下载工具包,后解压. http://closure-templates.googlecode.com/files/closure-templates-for-javascript-latest.z ...

  10. ios 网络字节顺序的转换HTOS

    最近用socket发送data遇到个问题,字节高地位和服务器不匹配,搞了好久才找到解决的方案,主要用到两个函数HTOL HTOS STOH LTOL 故写此博文 什么是字节序 采用维基百科的解释如下: ...