Use JQUERY to add and delete elements. For more information, see add and delete elements with JQUERY.
JQuery provides methods to add and delete elements.
It can be divided into internal insertion, external insertion, package replacement, and deletion.
Main Internal insertion methods:
Append (content) adds content to each matching element.
Prepend (content) pre-content to each matching element.
External insert:
After (content) inserts content after each matching element.
Before (content) inserts content before each matching element.
Delete:
Empty () deletes all child nodes in the matched element set.
Remove ([expr]) removes all matching elements from the DOM.
The following example shows how to Insert a new row to the table by clicking the Add button.
Click Delete to delete the last row.
The Code is as follows:
Add/delete table elements