javascript - 如果文本存在,则重新加载页面

标签 javascript jquery

我正在尝试在页面上搜索文本,如果找到文本,则重新加载页面。

<p class="textmedium">These are the droids I'm looking for</p>

最佳答案

这应该做到:

if($('*:contains("These are the droids I\'m looking for")').length > 0) {
    document.href.location = document.href.location; // refresh the page
}

关于javascript - 如果文本存在,则重新加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14778821/

相关文章:

jquery - Soundcloud iframe 在 iOS 下停止工作

javascript - 如何使用 table2excel 将带标题的表格导出到 Excel

javascript - Express.js 中的错误处理

javascript - raphael.2.1.0.min.js 具有无效的 UTF-8 字节序列

javascript - jQuery 自动完成组合框 - 清除焦点上的选择

javascript - 如何在我的 Aurelia 项目中本地使用 AWS SDK

javascript - 使用按钮单击事件 javascript 突出显示多条记录

javascript - 解析 Adob​​e InDesign 的 HTML 文本——其他标签内的标签

java - 使用 javascript 重定向到新 URL

javascript - 简单的 JavaScript 选择器