Hello, I'm doing a search field where it brings the data of an XML.
However, it is only bringing if I type the name in the right order, for example: in xml, the person's name is "Manoel da Silva", but if I only write "Manoel Silva" in the search field, it does not returns the data of the person ... only returns if I put the "da" in the middle of the name ...
Piece of code:
$(xml).find('dado').each(function() {
var doc = $(this).find('doc').text(),
razao = $(this).find('razao').text(),
fantasia = $(this).find('fantasia').text(),
cidade = $(this).find('cidade').text(),
uf = $(this).find('uf').text();
//var regex = new RegExp(razao, "g");
//var test = regex.test(nomeFiltro);
//console.log(test);
window.indexN = razao.toLowerCase().indexOf(nomeFiltro);
Any ideas?