JQuery復選框全選效果如何實現(xiàn)_第1頁
JQuery復選框全選效果如何實現(xiàn)_第2頁
JQuery復選框全選效果如何實現(xiàn)_第3頁
JQuery復選框全選效果如何實現(xiàn)_第4頁
JQuery復選框全選效果如何實現(xiàn)_第5頁
全文預覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

第JQuery復選框全選效果如何實現(xiàn)第一種方法:選擇器[屬性名稱=屬性值]

$(input[type=checkbox]:gt(0)).prop(checked,this.checked);

第二種方法:使用層級選擇器來實現(xiàn)tbodytrtdinput

$(tbodytrtdinput).prop(checked,this.checked);

第三種方法:

//#tabtbodytr:nth-child(4)td:nth-child(1)input[type=checkbox]

代碼實現(xiàn)

!DOCTYPEhtml

html

head

metacharset=UTF-8

title/title

scripttype=text/JavaScriptsrc=../js/jquery-1.11.0.js/script

script

表格全選和全不選

進一步確定事件:點擊事件

$(function(){

//綁定點擊事件

//this代表的是當前函數(shù)的所有者

$(#checkAll).click(function(){

//獲取當前選中狀態(tài)

//alert(this.checked);

//獲取所有分類項的checkbox

//選擇器[屬性名稱=屬性值]

//$(input[type=checkbox]:gt(0)).prop(checked,this.checked);

//使用層級選擇器來實現(xiàn)tbodytrtdinput

//$(tbodytrtdinput).prop(checked,this.checked);//這個可行

//#tabtbodytr:nth-child(4)td:nth-child(1)input[type=checkbox]

$(input).prop(checked,this.checked);

/script

/head

body

tableborder=1pxwidth=600pxid=tab

thead

inputtype=checkboxid=checkAll/

/td

td分類ID/td

td分類名稱/td

td分類商品/td

td分類描述/td

td操作/td

/tr

/thead

tbody

inputtype=checkbox/

/td

td1/td

td手機數(shù)碼/td

td華為,小米,尼康/td

td黑馬數(shù)碼產(chǎn)品質(zhì)量最好/td

ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow修改/a|ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow刪除/a

/td

/tr

inputtype=checkbox/

/td

td2/td

td成人用品/td

td充氣的/td

td這里面的充氣電動硅膠的/td

tdahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow修改/a|ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow刪除/a/td

/tr

inputtype=checkbox/

/td

td3/td

td電腦辦公/td

td聯(lián)想,小米/td

td筆記本特賣/td

tdahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow修改/a|ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow刪除/a/td

/tr

inputtype=checkbox/

/td

td4/td

td饞嘴零食/td

td辣條,麻花,黃瓜/td

td年貨/td

tdahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow修改/a|ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow刪除/a/td

/tr

inputtype=checkbox/

/td

td5/td

td床上用品/td

td床單,被套,四件套/td

td都是套子/td

tdahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollowrel=externalnofollow修改/a|ahref=#rel=externalnofollowrel=externalnofollowrel=externalnofollowrel=exter

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論