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("<[^>]*>","");
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; }
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!