当前位置:网站首页>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

边栏推荐
猜你喜欢

Numpy learning

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

Today in history: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal

A review of nature: gender differences in anxiety and depression - circuits and mechanisms

Online shopping E-commerce mall system based on jsp+servlet+mysql+

How to create a simple electron desktop program

Niuke dynamic planning training

滴滴 - dispatching

enq: HW – contention等待引起的故障分析

CAS operation
随机推荐
P1047 [noip2005 popularization group t2] tree outside the school gate
Efcore's solution of multi tenant zero script, table and database read-write separation under SaaS system
Interview questions: common faults and occurrence scenarios of redis
My creation anniversary
Pet adoption system based on ssm+mysql+layui
Supplementary notes on Relevant Issues of complete model group
Programmers can't play at the age of 35. Is it a fact or a misunderstanding?
交叉熵计算公式
Calculation formula of cross entropy
Test the mock data method of knowing and knowing
Science: listening to music can really relieve pain. Chinese scientists reveal the neural mechanism behind it
475-82(230、43、78、79、213、198、1143)
Summary of SQL skills in data warehouse development
A simple SQL injection shooting range exercise
Today in history: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
CAS operation
机器学习理论及案例分析(part2)--回归
mysql 如何获取两个集合的交集/差集/并集
ArcGIS Pro脚本工具(10)——从图层生成.stylx样式符号
JS pop up picture Lightbox light box plug-in spotlight.js