2
Hello, I’m doing a search field where it brings the data from an XML.
However, it is only bringing if I type the name in the right order, for example: in xml, the name of the person is "Manoel da Silva", but if I write only "Manoel Silva" in the search field, it does not return 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 idea?
I’m not going to give you the answer, because I’m not sure how to do it, but I think you’re going to have to use something like a query like, follow the documentation http://api.jquery.com/category/selectors/
– Thiago Friedman