如果文本存在,请重新加载页面 [英] If text exists, reload the page

查看:58
本文介绍了如果文本存在,请重新加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to do a search on page for text, and if the text is found, reload the page.

<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
}

这篇关于如果文本存在,请重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆