I'm trying to make a search for an XML tree. This search is made through a specific node attribute. Although it already works, I want to make this search case insensitive, so it can return every single node with that attribute value.
With that in mind, I decided to make a simple function that receives an XML and the input value (texto parameter is that input). But I can't seem to make it work, I know the problem is in the match function, if I create a value like var technician = "technician " and put that value in the match, it works, but I want to make it dynamic, since the values should be coming from an input. How can I do it?
function caseinsensitve(xml, texto) {
$(xml).find('profissao').filter(function () {
return ($(this).attr('codigo') || '').match(/texto/i);
});
}