## table表格全選:
~~~
$(function () {
/*全選*/
$("table thead th input:checkbox").on("click", function () {
$(this).closest("table").find("tr > td:first-child input:checkbox").prop("checked", $("table thead th input:checkbox").prop("checked"));
});
});
~~~
使用layui,
~~~
layui.define(['jquery', 'form', 'layer', 'element'], function (exports) {
var $ = layui.jquery,
form = layui.form,
layer = layui.layer,
element = layui.element;
var menu = [];
var curMenu;
/* 監聽狀態設置開關 */
form.on('switch(switchStatus)', function (data) {
var that = $(this),
status = 0;
if (!that.attr('data-href')) {
layer.msg('請設置data-href參數');
return false;
}
if (this.checked) {
status = 1;
}
$.get(that.attr('data-href'), {
val: status
}, function (res) {
layer.msg(res.msg);
if (res.code == 0) {
that.trigger('click');
form.render('checkbox');
}
});
});
/* TR數據行刪除 */
$('.j-tr-del').click(function () {
var that = $(this),
href = !that.attr('data-href') ? that.attr('href') : that.attr('data-href');
layer.confirm('刪除之后無法恢復,您確定要刪除嗎?', {}, function (index) {
if (!href) {
layer.msg('請設置data-href參數');
return false;
}
$.get(href, function (res) {
layer.msg(res.msg);
if (res.code == 1) {
that.parents('tr').remove();
that.parents('.tr').remove();
}
});
layer.close(index);
});
return false;
});
});
~~~
- thinkphp
- thinkphp筆記
- 后臺登陸退出
- config配置
- 隱藏后臺模塊
- 單獨調用騰訊云行為驗證碼
- api接口跨域問題
- api接口創建案例代碼
- 使用gateway worker
- 使用swoole代碼筆記
- 使用隊列 think-queue筆記
- 后臺布局
- MySQL
- 1、關于lnmp mysql的一個坑
- 2、mysql實現group by后取各分組的最新一條
- 其他
- 搞笑的注釋代碼
- 分頁類
- nodejs 打包網址為exe
- 免費天氣預報API接口
- Ajax
- 簡單的ajax分頁1
- 通用ajax-post提交
- 引用的類庫文件
- Auth.php
- Auth.php權限控制對應的數據庫表結構
- Layui.php
- Pinyin.php
- Random.php
- Tree.php
- Tree2.php
- Js-Jq
- Git的使用
- 3、bootstrap-datetimepicker實現兩個時間范圍輸入
- CentOS安裝SSR做梯子
- Python爬蟲
- 1、安裝Gerapy
- 2、安裝Scrapy
- 3、Scrapy使用
- 4、Scrapy框架,爬取網站返回json數據(spider源碼)
- 0、Python pip更換國內源(一句命令換源)
- 服務器運維
- 1、寶塔使用webhook更新服務器代碼
- 2、搭建內網穿透
- 3、數據庫主從同步
- 4、數據庫復制
- hui-Shop問題
- 1、前端模板的注意事項
- 2、模板標簽