Home > Article > Web Front-end > How to remove js from html tag
This article mainly shares with you how to remove the js method of html tags. I hope it can help you learn how to remove js of html tags.
<script> function delHtmlTag(str){ return str.replace(/<[^>]+>/g,"");//去掉所有的html标记 } var str = "<span style='display:none;'>This is test</span><img src=''>ss</img><strong></strong><br/>"; str = delHtmlTag(str); alert(str); </script>
Java seems to be this Str.replaceAll("549a3fd9a3c62568d8b32cd8627105c3]*>","");
The modification made to the html tag for a title:
function delHtmlTag(str, obj){ var title = str.replace(/<[^>]+>/g,"");//去掉所有的html标记 if(title.length > 300) { title = title.substring(0,300); } obj.title = title; }rrree
The above is the detailed content of How to remove js from html tag. For more information, please follow other related articles on the PHP Chinese website!