当前位置:网站首页>Chapter 3 business function development (realize the real-time response of the select all button)
Chapter 3 business function development (realize the real-time response of the select all button)
2022-07-25 08:09:00 【Make a light】
customer demand :
When you click the select all box , Check all boxes , And check the check boxes of all data .
When you click the select all box again , Check all boxes to cancel , And the check boxes of all data are also checked and cancelled .
After clicking the select all box , When you click the check box of the data item, uncheck the current data item , The check all box should also be unchecked
Function development :
stay index.jsp Page js Write in
// Set the select all function for the select all button
$("#checkAll").click(function () {
$("#tBody input[type='checkbox']").prop("checked",this.checked);
});
// Add a click event to the data item's multiple selection box
$("#tBody").on("click","input[type='checkbox']",function () {
if ($("#tBody input[type='checkbox']").size()==$("#tBody input[type='checkbox']:checked").size()){
$("#checkAll").prop("checked",true);
} else {
$("#checkAll").prop("checked",false);
}
});The data of this page comes from jquery The joining together of , These data are all spliced into tBody In the label box of
success:function (data) {
// Show campaign list
var htmlStr="";
$.each(data.clues,function (index,obj) {
htmlStr+="<tr class=\"active\">";
htmlStr+="<td><input type=\"checkbox\" /></td>";
htmlStr+="<td><a style=\"text-decoration: none; cursor: pointer;\" onclick=\"window.location.href='detail.html';\">"+obj.fullname+"</a></td>";
htmlStr+="<td>"+obj.company+"</td>";
htmlStr+="<td>"+obj.phone+"</td>";
htmlStr+="<td>"+obj.mphone+"</td>";
htmlStr+="<td>"+obj.source+"</td>";
htmlStr+="<td>"+obj.owner+"</td>";
htmlStr+="<td>"+obj.state+"</td>";
htmlStr+="</tr>";
});
$("#tBody").html(htmlStr);A functional test :
Click the select all button

Click the select all button again

After clicking the select all button , Click a data item to uncheck it , The select all button will also be deselected in real time

边栏推荐
- The 17th revitalization cup computer programmer (cloud computing platform operation and development) finals
- 机器学习入门详解(一):理解监督学习中的最大似然估计
- Network file storage system (II) practical operation of Minio distributed file system
- How to create a simple electron desktop program
- pom容易忽略的问题
- How to obtain the intersection / subtraction / Union of two sets by MySQL
- Learn when playing No 2 | learning is too boring? Learning maps lets you learn and play
- Raspberry Pie 3 connected to WiFi
- A powerful port scanning tool (nmap)
- CentOS 8.2 MySQL installation (xshell6)
猜你喜欢
P1086 [noip2004 popularization group question 2] peanut picking

Introduction and installation of mongodb

Hotel room management system based on jsp+servlet+mysql

【音视频】图片YUV数据格式

Leetcode (Sword finger offer) - 04. search in two-dimensional array

Oracle trigger creation

查看电脑重启次数、原因

Advanced C language (11) - user defined data types

Science: listening to music can really relieve pain. Chinese scientists reveal the neural mechanism behind it

Surpassing transformer, Tsinghua, byte significantly refresh parallel text generation SOTA performance | ICML 2022
随机推荐
enq: HW – contention等待引起的故障分析
Learn no when playing 8 | the enterprise saves hundreds of thousands in an instant, just because it uses it
CAS operation
IoT物联网嵌入式设备中30种常见传感器模块简介及原理讲解
Didi eta (estimate the travel time)
How to create a simple electron desktop program
Install MySQL 8.0 using docker
File details
Raspberry pie creation self start service
A powerful port scanning tool (nmap)
【keras bug】Tensor is unhashable if Tensor equality is enabled. Instead, use tensor.experimental_ ref(
Cerebral cortex: the relationship between lifestyle and brain function in the elderly and its relationship with cognitive decline
Literature learning (part101) -- converge clustering
Learn when playing No 5 | human high quality examination, right here →
Online shopping E-commerce mall system based on jsp+servlet+mysql+
A simple SQL injection shooting range exercise
Refreshing mobile terminal personal center page
Redis学习
ArcGIS Pro scripting tool (10) -- generate.Stylx style symbols from layers
Learn when playing No 3 | are enterprise learning resources wasted? Learn map one trick to solve!