javascript - 使用替换替换标记中的特定 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="font-family: arial, helvetica, sans-serif;font-size: 16px;color: #494c4e;">\n<html><head></head><body><p><iframe src="/d2l/lp/" height="200px" width="600px"></iframe></p>\n<p>Hello John Okay!iss tgjgjjk blhk fsf daught duck stewn sabjkbb bnsadn nnotnnnn bj</p>\n<p>\n<script src="/shared/js/epy.js"></script>\n</p></body></html>\n</body></html>\">"
解决方案
我以前也遇到过这样的问题,只是我尝试访问的方式不对,检查的很好,你可能尝试访问错误的功能。
推荐阅读
- powershell - 从一个实例复制到另一个实例
- php - 如何使用 PHP 脚本为 FTP 服务器制作 Web UI?
- r - shinyWidgets 中未使用的参数错误:airDatepickerInput
- python-3.x - 使用 python 进行 Instagram 网页抓取
- python - 是否可以在函数中嵌入 argsparse 解析器?
- combobox - 组合框是否需要具有文本框角色的子元素?
- windows - 与 I/O 操作相关的 sys 包问题
- python - 在 pyinstaller 中找不到模块
- android-espresso - 如何在 Kotlin Flow 中使用 Espresso?
- lisp - 打印输入数字的总和