String.stripTags()

去除字符串里的所有标记。

参数

返回值

两端去除空格后的新字符串。

描述

该方法适用于去除 html 代码中的标记,与 innerText 类似。

示例

<div class="box" id="box">
<h1 class="title">奥林匹克会旗</h1>
<p class="content">会旗为白底无边,中央有五个相互套连的圆环,即我们所说的奥林匹克环。</p>
</div>
<input type="button" value="stripTags" onclick="alert( $('box').innerHTML.stripTags() )" /> //奥林匹克会旗
会旗为白底无边,中央有五个相互套连的圆环,即我们所说的奥林匹克环。