)|(<\/?span.*?>)/g, ' ');" method can remove the a tag."> How to remove a tag in javascript-Front-end Q&A-php.cn

How to remove a tag in javascript

藏色散人
Release: 2021-06-27 10:45:46
Original
3094 people have browsed it

How to remove the a tag in javascript: first find the corresponding js code part; then pass "str.replace(/()|()/g, '') ;" method can remove the a tag.

How to remove a tag in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to remove the a tag in javascript?

Specific question:

js to remove the a tag and leave the content

How to use regular rules to remove the a tag and leave only the content http:/ /git.oschina.net

The way to replace the a tag part with empty is not to directly take the content of the a tag, because there are a lot of such codes, and there are other codes that need to be left in place

http://git.oschina.net
Copy after login

Implementation method:

(<\/?a.*?>)|(<\/?span.*?>)
Copy after login

That is:

str.replace(/(<\/?a.*?>)|(<\/?span.*?>)/g, '');
Copy after login

Running results

How to remove a tag in javascript

##[Recommended learning:

javascript advanced tutorial

The above is the detailed content of How to remove a tag in javascript. 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
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!