javascript - 如何从 HTML 字符串中删除代码?

标签 javascript jquery regex

我有一个包含这个字符串的变量:

<DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 10pt">[If the confirmation is active the subscriber will receive this email after succesfully confirming. If not, this will be the first and only email he will receive.]</SPAN></DIV>
<p align=center>
    <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()">
</p>

如何通过 Javascript(或 jQuery)删除下面的字符串而不用担心空格?

<p align=center>
    <input class=fieldbox10 type = 'button' name = 'button' value = 'Close' onclick = "window.close()">
</p>

最佳答案

也许是这个?

$(html).remove('p');

关于javascript - 如何从 HTML 字符串中删除代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2679718/

相关文章:

javascript - 显示数组中的特定对象值而不是单独显示?

jquery - 所有容器同时出来

javascript - 使用 jQuery 创建垂直 slider

java - 使用正则表达式提取子字符串,但如果字符串与正则表达式不匹配则保留它

javascript - 作为构建过程的一部分,从 Node/Express View 渲染静态 HTML 文件

javascript - 绘制自定义折线图和柱形图

javascript - 以 Angular 4 在路由器导出外加载页面

jquery - 如何使用 jquery 将一个 div 附加到两个不同的 div?

c# - 查找以下划线开头的单词

ruby - 如何使用gsub简化正则表达式