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

Use JS to implement page deletion and reordering functions

怪我咯
怪我咯Original
2017-03-29 15:53:161695browse

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

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



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");



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);
});

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!

Statement:
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