首页 > 解决方案 > 使用替换替换标记中的特定 html 标记

问题描述

我的控制台中返回了一块标记。我只是想使用 .replace 来更改标签或删除标签。当我尝试使用 .replace 时 - 它说不是函数,但是当我将其更改为 .html().replace("

","") 没有任何反应。有什么帮助吗?

//.html().replace("<p></p>,"");
"<div class=\"files\" data-scope=\"topicContent\"></div><input type=\"hidden\" name=\"topicContent$id\" id=\"topicContent$id\" value=\"topicContent\">\n\t\t\t\t\t<input type=\"hidden\" name=\"more\" id=\"\" value=\"11961\">\n\t\t\t\t\t<input type=\"hidden\" class=\"editor\" name=\"topicContent$html\" id=\"topicContent$html\" value=\"<!DOCTYPE html>\n<html><head>\n\n</head>\n<body style=&quot;font-family: arial, helvetica, sans-serif;font-size: 16px;color: #494c4e;&quot;>\n<html><head></head><body><p><iframe src=&quot;/d2l/lp/&quot; height=&quot;200px&quot; width=&quot;600px&quot;></iframe></p>\n<p>Hello John Okay!iss tgjgjjk blhk fsf daught duck stewn sabjkbb bnsadn nnotnnnn bj</p>\n<p>\n<script src=&quot;/shared/js/epy.js&quot;></script>\n</p></body></html>\n</body></html>\">"

标签: javascripthtml

解决方案


我以前也遇到过这样的问题,只是我尝试访问的方式不对,检查的很好,你可能尝试访问错误的功能。


推荐阅读