I'm using the code below to search data in a json, and works perfectly in Chrome and Firefox, but in mobile browser it does not work, and simply does not return anything:
function searchTitles(e){
var val = decodeURI(e);
var data = Object.values(meu_json).filter(function(objecto) {
return objecto.titulo.toLowerCase().indexOf(val.toLowerCase()) > -1
});
if(data == ""){
var data = Object.values(meu_json).filter(function(objecto) {
return objecto.categoria.toLowerCase().indexOf(val.toLowerCase()) > -1
});
}
if(data != ""){
alert(data);
}else {
alert('error');
}
}
When using in chrome or firefox, it returns the data and data != ""
but the same in a mobile browser, it does not work, it just does not happen, there is no error message.