基於JQ的多選 全選 反選及獲取選中的值

2022-03-28 03:02:01 字數 2080 閱讀 5093

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

title

>多選/全選/反選 獲取選中的值

title

>

head

>

<

body

>

<

p>中國古代十大名劍

p>

<

input

type

="checkbox"

value

="全選"

id="selectall"

/>

全選

<

div

id="checkboxlist"

class

="check-all"

>

<

input

type

="checkbox"

value

="軒轅"

/>軒轅<

br>

<

input

type

="checkbox"

value

="湛瀘"

/>湛瀘<

br>

<

input

type

="checkbox"

value

="赤霄"

/>赤霄<

br>

<

input

type

="checkbox"

value

="太阿"

/>太阿<

br>

<

input

type

="checkbox"

value

="七星龍淵"

/>七星龍淵<

br>

<

input

type

="checkbox"

value

="幹將"

/>幹將<

br>

<

input

type

="checkbox"

value

="莫邪"

/>莫邪<

br>

<

input

type

="checkbox"

value

="魚腸"

/>魚腸<

br>

<

input

type

="checkbox"

value

="純鈞"

/>純鈞<

br>

<

input

type

="checkbox"

value

="承影"

/>承影<

br>

div>

<

button

id="getcheckval"

>獲取選中的值

button

>

<

script

src=""

>

script

>

<

script

>

$(function

());

$("#checkboxlist :checkbox

").click(

function

()else

});$(

"#getcheckval

").click(

function

()) })

})script

>

body

>

html

>

jq 實現全選反選,獲取選中的值

function input name chk list normal on click function else 一般專案實現全選 實現全選反選 chk all on click function input name chk list on click function else div cl...

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...

jq 全選 反選 判斷選中的條數

1 全選或全不選。當勾選全選按鈕 selectall旁邊的核取方塊 all時,列表中的選項全部選中,反之取消勾選則列表中的選項全部為未選中狀態。all click function else 2 全選。當點選全選按鈕 selectall或者勾選全選按鈕旁邊的核取方塊 all時,列表中所有的選項都會被...