How to remove br in jquery

WBOY
Release: 2022-06-08 17:01:44
Original
2458 people have browsed it

Jquery method to remove br: 1. Get the br element, the syntax is "$("br")", which will return a jquery object containing the specified element; 2. Use the remove() function to remove the obtained The br element object is sufficient. The syntax is "br element object.remove()", which will delete the br element and all text and child nodes in it.

How to remove br in jquery

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

How to remove br

remove() method with jquery removes selected elements, including all text and child nodes.

This method will also remove the data and events of the selected element.

The syntax is:

$(selector).remove()
Copy after login

The example is as follows:

    123   

这是一个段落。


这是另一个段落。


Copy after login

Output result:

How to remove br in jquery

Related video tutorials Recommended:jQuery video tutorial

The above is the detailed content of How to remove br in jquery. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!