For (the let I=1; I & lt; Tableth. Length; I++) {
Tableth [I] querySelectorAll (" td ") [2]. The remove ()
Tableth [I] querySelectorAll (" td ") [4]. The remove ()
}
Tableth [0]. QuerySelectorAll (" th ") [2], the remove ()
Tableth [0]. QuerySelectorAll (" th ") [4]. The remove ()
}
Document. QuerySelector (" sxtj2 "). The onclick=function () {
For (the let I=1; I & lt; Tableth. Length; I++) {
Tableth [I] querySelectorAll (" td ") [2]. The remove ()
Tableth [I] querySelectorAll (" td ") [4]. The remove ()
}
Tableth [0]. QuerySelectorAll (" th ") [2], the remove ()
Tableth [0]. QuerySelectorAll (" th ") [4]. The remove ()
}
Click sxtj1 remove elements, but delete only once, and once again points will not continue to delete, click sxtj2 before return to delete, how do I do?
CodePudding user response:
1, the initialization before (delete) the content of the preserved to a variable;2, define a variable isdelete=false, when click sxtj1 to determine whether the variable is true, is true, return not to true variable to true;
3, click sxtj2, the first step to save data rendering once line