js去除字符串

Kent_Sun 20 0 0

js去除字符串

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>

</body>
<script type="text/javascript">
    function delHtmlTag(str){
      return str.replace(/<[^>]+>/g,"");
    }
    var str = "<h1>牛总666</h1>";
    str = delHtmlTag(str);
    alert(str);
</script>
</html>
预览图
收藏
评论区