How can I perform a search on a DIV similar to Chrome's Ctrl + F with javascript?
Regardless of uppercase, lowercase, accents, etc.
So far I have the result below. I get the term found and check if there is any occurrence in the text. But when the occurrence has an accent, it does not stand out.
I'm using this script to get the result in the image.
var searchTerm = "CLAUDIA";
var html = $("#texto").text();
var pattern = "([^\w]*)(" + searchTerm + ")([^\w]*)";
var rg = new RegExp(pattern, "gi");
var match = rg.exec(html);
if(match) {
html = html.replace(rg,match[1] + "<b>"+ match[2] +"</b>" + match[3]);
$("#texto").text(html);
}