如果沒有後臺的話 直接用js轉換壹下尖括號就可以了
基本代碼如下:
<script?src="/jquery/3.2.1/jquery.js?"></script><textarea?id="htmls"></textarea>
<div?id="out"></div>
<span?id="clickBut">點擊</span>
<script?type="text/javascript">
$("#clickBut").click(function(){ var?html?=?$("#htmls").val(); html?=?html.replace(/</g,"<"); html?=?html.replace(/</g,">"); html?=?html.replace(/\n/g,"<br>"); html?=?html.replace(/\t/g," "); console.log(html); $("#out").html(html); })</script>
我在mac chrome測試無問題。
具體的妳可以根據自己的需求再修改。