$(function () )$("input[name='chk_list_normal']").on('click', function () else
})//一般專案實現全選
//實現全選反選
$("#chk_all").on('click', function () )
$("input[name='chk_list']").on('click', function () else
})})
<div
class
="row "
>
<
div
class
="col"
>
<
label
>主控專案:
label
>
div>
div>
<
div
class
="row "
>
<
div
class
="col"
>
<
ul class
="list-group"
>
<
li class
="list-group-item"
>
<
input
type
="checkbox"
name
="chk_list"
class
="form-check-input"
>1地基承載力
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_list"
class
="form-check-input"
>2配合比
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_list"
class
="form-check-input"
>3壓實係數
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_all"
id="chk_all"
class
="form-check-input"
>全選
li>
ul>
div>
div>
<
div
class
="row"
>
<
div
class
="col"
>
<
label
>一般專案:
label
>
div>
div>
<
div
class
="row "
>
<
div
class
="col"
>
<
ul class
="list-group"
>
<
li class
="list-group-item"
>
<
input
type
="checkbox"
name
="chk_list_normal"
class
="form-check-input"
>1石灰粒徑(mm)
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_list_normal"
class
="form-check-input"
>2土料有機含量(%)
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_list_normal"
class
="form-check-input"
>3土顆粒粒
li>
<
li class
="list-group-item"
><
input
type
="checkbox"
name
="chk_all_normal"
id="chk_all_normal"
class
="form-check-input"
>全選
li>
ul>
div>
div>
js獲取選中的值
var arr =;$("for (var i = 0; i < obj.length; i++).likes input:checkbox[name='like']:checked
").each(function(i));
console.log(
'-----選中的值-----
', arr);
//第二種方式
}
基於JQ的多選 全選 反選及獲取選中的值
doctype html html lang en head meta charset utf 8 title 多選 全選 反選 獲取選中的值 title head body p 中國古代十大名劍 p input type checkbox value 全選 id selectall 全選 div ...
jq 全選 反選 判斷選中的條數
1 全選或全不選。當勾選全選按鈕 selectall旁邊的核取方塊 all時,列表中的選項全部選中,反之取消勾選則列表中的選項全部為未選中狀態。all click function else 2 全選。當點選全選按鈕 selectall或者勾選全選按鈕旁邊的核取方塊 all時,列表中所有的選項都會被...
jq實現批量全選與反選
doctype html html lang en head meta charset utf 8 title document title head body input type button value 刪除 table border 1 thead tr th input type chec...