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!