js remove all tag elements in the html string, combined with vue expressions

1. Before removing, the bound code is: <td v-html="q.title"></td>

The effect of the display is that the corresponding html element is also displayed. Here I only need his plain text, without any format (html code):


2. Remove all the tag element js code in the html string:

function delHtmlTag(str){
    return str.replace(/<[^>]+>/g,"");
}
3. Vue binding changes: <td v-html="delHtmlTag(q.title)"></td>

4. Only display plain text



Intelligent Recommendation

Regularly remove the html tag from the string

We often use the rich text editor when posting articles on the webpage. The rich text editor can personalize the content of the article, and also add some media elements to enrich the content of the a...

js remove all spaces in the string

js remove all spaces in the string...

JS regular expressions to remove the punctuation string

Input: “A man, a plan, a canal: Panama” Output: “AmanaplanacanalPanama”...

JS regular expressions string to remove whitespace

The above method is through a regular expression to achieve In addition introduce some simple regular expression pattern: Some quantifiers: Complex patterns:    ...

More Recommendation

[VUE] How to get all methods of an HTML tag

Method: console.dir () can display all of the properties and methods of objects The output is shown in the following figure:...

Ios extract imgURL in html string and remove html tag

When we encounter a html' string returned in the background, this string contains the imgURL tag and the text, but need to display the text and the picture separately, this time we need to extract the...

Use regular expressions to delete all attributes in a certain html tag

If you want to delete, contains a specific attributeAll attributes in the label; Example: Need to delete the program attributeAll the attributes in; Output result:...

vue (Js) to remove elements from an array

Reprint: Usage: arr.splice (arr.indexOf (ele), length): Get this array represents the first subscript of the element, then the index is calculated from the start, an element length of the length of de...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top