Maybe many people do not need to convert the data into html tags when reading data from the database, but maybe one day you will find that when we need to output it into html tags, the compiler automatically outputs it into a string for us. This is us You can do it this way
Method 1:
The most common method, use JS or JQ
JQ:
$("#div").html("I am HTML code");
JS:
var dobj=document.getElementById("div"); dobj.innerHTML = "<span>我是HTML代码</span>";
Method 2:
When you find that the data read from the database cannot be used by the above two methods, you can try it
$("#div").html(“@Html.Raw(我是数据库中的HTML代码)”);