Today I saw a little trick for HTML text escaping on CSDN, which is very simple. 1. Use dom functions. First pass it to a DOM object as innerTEXT, then take the innerHTML attribute to get the escaped text. For example: div1.innerText = "<h1>title title....</h1>"; var str = div1.innerHTML; // "<h1>title title..." 2. Assuming there is a text context, you can perform $(x).text(context).html() on a jQuery object $(x), which will return an escaped text. var str = $(x).text(context).html() |
<<: The difference between docker run and start
>>: How to use the EXPLAIN command in SQL
Table of contents 1. Introduction 2. Main text 2....
Since I need to learn how to build servers and da...
Preface This is an old demand, but there are stil...
1. Some tips on classes declared with class in re...
Environment: init_worker_by_lua, set_by_lua, rewr...
1. Create a repository in the specified directory...
Installation Script Ubuntu / CentOS There seems t...
This article will introduce how to query data in ...
Preface In many cases, we will use virtual machin...
1. Refer to the official website to install docke...
Latest solution: -v /usr/share/zoneinfo/Asia/Shan...
This article example shares the specific code of ...
The traditional method is to write a square in a ...
[LeetCode] 181.Employees Earning More Than Their ...
Detailed explanation of HTML (select option) in ja...