I have written this code to search a product for woocommerce wordpress plugin.
//product filter
jQuery(document).on("keyup",".pstext",function(){
jQuery(".nopro").remove();
var searchterm = jQuery(".pstext").val();
if(searchterm === ""){
jQuery(".main-flavour").show();
return;
}
jQuery(".main-flavour").hide();
var curr_item = "";
var found = 0;
jQuery(".main-flavour").each(function(){
curr_item = jQuery(this).children("input").attr("id").replace("-"," ");
if(curr_item.indexOf(searchterm) != -1){
found = 1;
jQuery(this).show();
}
});
if(found === 0 && jQuery('.addon-description').find('p.nopro').length === 0){
jQuery(".addon-description").append("<p class='nopro'>No Products Found.</p>");
}
});
This code is working fine on desktop but not working on mobile device.
Can you guys help me resolve this code for mobile devices.