Home > Article > Web Front-end > How to delete td elements in jquery
In jquery, you can use the remove() method to delete the td element. This method is used to remove the selected element, including all text and child nodes of the selected element. The syntax is "td element object.remove( );".
The operating environment of this tutorial: windows7 system, jquery3.6.1 version, Dell G3 computer.
remove() method removes the selected elements, including all text and child nodes.
This method will also remove the data and events of the selected element.
Tip: If you need to remove elements but retain data and events, please use the detach() method instead.
Tip: If you only want to remove content from the selected element, please use the empty() method.
The syntax is as follows:
$(selector).remove()
The example is as follows:
123
姓名 | 年龄 |
---|---|
Peter | 20 |
Lois | 20 |
Output result:
Related video tutorials Recommended: jQuery video tutorial
The above is the detailed content of How to delete td elements in jquery. For more information, please follow other related articles on the PHP Chinese website!