innerhtml - 有没有办法搜索搜索所有字符(包括“<”字符)的字符串?
问题描述
我会尽量具体一点。我尝试使用 ..text.content 和 ..innerhtml 并且在搜索时似乎都缺少“<”字符。在下面搜索这个总字符串时,看不到它。
这就是我在特定的 html 页面上搜索的内容。
'''
'231-8"},"availability_html":"<p class=\"stock out-of-stock'
''' 这是我的代码...
'if ('
'document.documentElement.textContent.search('231-8"},"availability_html":"<p class=\"stock out-of-stock') != -1)'
'{'
'alert("FOUND!");'
'} else {'
'alert("NOT FOUND!");'
'}'
''' 我可以搜索字符串的第一部分一直到 "<" 部分,它工作正常。
我究竟做错了什么?
解决方案
这是我的解决方案,我想通了...
'231-8"},"availability_html":"<p class=\\\\"stock out-of-stock
推荐阅读
- android - firebase、flutter应该如何处理好友请求和邀请?
- github - Pytest 未在 GitHub 操作上找到测试
- vba - 循环获取每个类 selenium vba 的名称
- github - 如何检查我们是否是存储库的所有者?
- find - 如何找到具有相同名称的第二个 div 类?
- ruby-on-rails - 为“x.jpg”状态 500 创建 Blob 时出错
- android - 有没有办法在常规适配器中获取 Firestore 数据?
- visual-studio-code - 如何在没有 vscode 对话框的情况下直接进入定义?
- material-ui - 如何使用省略号获取截断的 html 文本?
- ios - SKPaymentTransactionObserver 未调用 updatedTransactions