Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用phonegap、jquery、jquery mobile在ios中搜索文本(具有下一个和上一个功能)_Jquery_Jquery Mobile_Cordova - Fatal编程技术网

如何使用phonegap、jquery、jquery mobile在ios中搜索文本(具有下一个和上一个功能)

如何使用phonegap、jquery、jquery mobile在ios中搜索文本(具有下一个和上一个功能),jquery,jquery-mobile,cordova,Jquery,Jquery Mobile,Cordova,您能告诉我如何在查询中使用“下一个”和“上一个”功能从页面中搜索文本吗, 我找到了很多链接,但每个链接都会同时搜索所有搜索。但我需要它先搜索单词,然后使用“下一个”和“上一个”按钮转到下一个搜索文本。 我找到了这个 如果需要 $('#searchfor').keyup(函数(){ 变量页=$(“#所有#文本”); var pageText=page.text().replace(“,”).replace(“”); var searchedText=$(“#searchfor').val(); v

您能告诉我如何在查询中使用“下一个”和“上一个”功能从页面中搜索文本吗, 我找到了很多链接,但每个链接都会同时搜索所有搜索。但我需要它先搜索单词,然后使用“下一个”和“上一个”按钮转到下一个搜索文本。 我找到了这个

如果需要

$('#searchfor').keyup(函数(){
变量页=$(“#所有#文本”);
var pageText=page.text().replace(“,”).replace(“”);
var searchedText=$(“#searchfor').val();
var theRegEx=new RegExp(“(“+searchedText+”),“igm”);
var newHtml=pageText.replace(theRegEx,“$1”);
html(newHtml);
});
这把小提琴突出显示了在html上找到的所有单词

我还有JQuery插件,它有你想要的所有功能(突出显示,下一个/上一个)

如果有帮助的话

$('#searchfor').keyup(function(){
         var page = $('#all_text');
         var pageText = page.text().replace("<span>","").replace("</span>");
         var searchedText = $('#searchfor').val();
         var theRegEx = new RegExp("("+searchedText+")", "igm");    
         var newHtml = pageText.replace(theRegEx ,"<span>$1</span>");
         page.html(newHtml);
    });