Skip to content

Commit 579883f

Browse files
committed
Demos: update keyword addition to avoid adding more then once
1 parent ed592a4 commit 579883f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/_assets/js/jqm-demos.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ $( document ).on( "pageinit", ".jqm-demos-search-results", function() {
195195
return "";
196196
}
197197
});
198-
$(".jqm-search-results-list li").each(function(){
198+
$(this).find(".jqm-search-results-list li").each(function(){
199199
var text = $(this).attr("data-filtertext");
200200
$(this).append("<p class='jqm-search-results-keywords ui-li-desc'>Keywords: "+text+"</p>");
201201
});
@@ -207,13 +207,14 @@ $( document ).on( "pageshow", ".jqm-demos-search-results",function(){
207207
$( this ).find( ".jqm-content .jqm-search-results-wrap input").val( search ).trigger( "change" );
208208

209209
});
210-
$( document ).on( "change keyup",".jqm-search-results-wrap input" , function( event ) {
211-
$(".jqm-search-results-list li a, .jqm-search-results-list li p").each(function(){
210+
$( document ).on( "change keyup",".ui-page-active .jqm-search-results-wrap input" , function( event ) {
211+
console.log("change")
212+
$(".ui-page-active .jqm-search-results-list li a, .ui-page-active .jqm-search-results-list li p").each(function(){
212213
$(this).html($(this).html().replace("<span class='jqm-search-results-highlight'>",""));
213214
$(this).html($(this).html().replace("</span>",""));
214215
});
215-
var search = $(".jqm-search-results-wrap input").val();
216-
$(".jqm-search-results-list li a, .jqm-search-results-list li p").each(function(){
216+
var search = $(".ui-page-active .jqm-search-results-wrap input").val();
217+
$(".ui-page-active .jqm-search-results-list li a, .ui-page-active .jqm-search-results-list li p").each(function(){
217218
var text = $(this).text();
218219
$(this).html(text.replace(eval("/"+search+"/i"),"<span class='jqm-search-results-highlight'>"+search+"</span>"));
219220
});

0 commit comments

Comments
 (0)