Home > Web Front-end > JS Tutorial > Use JS to implement page deletion and reordering functions

Use JS to implement page deletion and reordering functions

怪我咯
Release: 2017-03-29 15:53:16
Original
1680 people have browsed it

First, use the jqury selector to select the checked row:

var cks = $("#indicator_table").find("input[type='checkbox']:checked");
Copy after login



Then a confirmation box will pop up to confirm whether to delete the box. Bind a delInd() event;

First remove or html (" ") the selected line on the page,

$("#indicator_table").find("input[type='checkbox']:checked").each(function(i, o){
// 获取checkbox所在行的顺序 
n = $(this).parents("tr").index();
$("#indicator_table").find("tr:eq(" + n + ")").remove();
});
$("#deleteModal").modal("hide");
Copy after login



After reordering the remaining rows, jqury selector is needed to select the rows of the table and perform circular assignment:

$("#indicator_table").find("tr").each(function(i){
$(this).find("td").eq(10).find("a").text(i+1);
});
Copy after login

The above is the detailed content of Use JS to implement page deletion and reordering functions. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template