jQuery - add/remove elements

jQuery - Adding Elements

With jQuery, it is easy to add new elements/content.

Add new HTML content

We will learn four jQuery methods for adding new content:

append() - Insert content at the end of the selected element

prepend() - Insert content at the beginning of the selected element

after() - Insert content after the selected element

before() - Insert before the selected element Content

       

这是一个段落。

jQuery - Deleting Elements

With jQuery, you can easily delete existing HTML elements.

Delete elements/content

If you need to delete elements and content, you can generally use the following two jQuery methods:

remove() - delete the selected element (and its children Element) empty() - deletes sub-elements from the selected element

      
这些是示例

这些是示例

这些是示例


Compare the two methods to distinguish usage.

      
这些是示例。

这些是示例。

这些是示例。



Continuing Learning
||

这是一个段落。

这是另外一个段落。

这是另外一个段落。

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!