全選 取消全選

2021-08-13 04:32:55 字數 2777 閱讀 1589

這裡用到angularjs四大特性之二----雙向資料繫結

注意:沒寫一行dom**!這就是ng的優點,bootstrap.css為了布局,js**也只是簡單建立ng模組和ng控制器

效果:

>全選/取消全選

title

>

head

>

<

body

>

<

div

class

="container"

ng-controller

="myctrl5"

>

<

h2>全選和取消全選

h2>

<

table

class

="table table-bordered"

>

<

thead

>

<

tr>

<

th>選擇

th>

<

th>姓名

th>

<

th>操作

th>

tr>

thead

>

<

tbody

>

<

tr>

<

td>

<

input

ng-checked

="selectall"

type

="checkbox"

>

td>

<

td>tom

td>

<

td>

<

button

class

="btn btn-danger btn-xs"

>刪除

button

>

td>

tr>

<

tr>

<

td>

<

input

ng-checked

="selectall"

type

="checkbox"

>

td>

<

td>mary

td>

<

td>

<

button

class

="btn btn-danger btn-xs"

>刪除

button

>

td>

tr>

<

tr>

<

td>

<

input

ng-checked

="selectall"

type

="checkbox"

>

td>

<

td>king

td>

<

td>

<

button

class

="btn btn-danger btn-xs"

>刪除

button

>

td>

tr>

tbody

>

table

>

<

input

type

="checkbox"

ng-model

="selectall"

>

<

span

ng-hide

="selectall"

>全選

span

>

<

span

ng-show

="selectall"

>取消全選

span

>

div>

<

script

src="js/angular.js"

>

script

>

<

script

>

//2、建立自定義模組和控制器

angular.module(

'mymodule5

', ['ng

']).

controller(

'myctrl5',

function

($scope));

script

>

body

>

html

>

jquery全選,取消全選

最近專案又用到了這個全選和取消全選的操作.如下 check all12 34 必須說的是jq1.6 以上才支援prop哦.關於prop可以看看下面這個.今天在用jquery的時候發現乙個問題用.attr checked 獲取checkbox的checked屬性時選中的時候可以取到值,值為 check...

jquery全選,取消全選

最近專案又用到了這個全選和取消全選的操作.如下 check all12 34 必須說的是jq1.6 以上才支援prop哦.關於prop可以看看下面這個.今天在用jquery的時候發現乙個問題用.attr checked 獲取checkbox的checked屬性時選中的時候可以取到值,值為 check...

全選 取消全選那點事

今天我花了半天時間處理checkbox全選 取消全選那點事 技術領域 可信計算 其他 全選 申請日2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2000 2001 2002 2...