Full-text search in JavaScript (part II)

Some years ago, I wrote a post about how to perform a full-text search in JavaScript modifying the DOM to highlight the results.

The aforementioned post has been outdated and there are better ways to perform a search in JavaScript, without using complex regular expressions, and without rewriting completely the HTML container on each search.

Read More »

Full-text search in JavaScript

There is a newer post with a better method to perform a full-text search in JavaScript.

Some time ago, I needed to create a full-text search in JavaScript in a project that I was working on. The requirement was to search the text directly in the DOM modifying it and highlighting the relevant results.

The majority of the scripts on the internet, explain how to search a text inside a string, but many of them focused on verifying if the text is present or not, using for it the indexOf or the search methods of the String object.

Read More »