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
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...
Input: “A man, a plan, a canal: Panama” Output: “AmanaplanacanalPanama”...
The above method is through a regular expression to achieve In addition introduce some simple regular expression pattern: Some quantifiers: Complex patterns: ...
Method: console.dir () can display all of the properties and methods of objects The output is shown in the following figure:...
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...
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:...
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...