I have an HTML table that is dynamically built and populated with data from a database. I want to incorporate a text search on the page so that when a user types a search term every term within a DIV that wraps the table is highlighted on a character-by-character basis.

Conversely, as the user deletes characters from the input search field, the highlights are recalculated to omit the deleted characters.

I have a script that I found online that works, but in some cases it inserts " " and "&" strings as I type in the input box and I cannot for the life of me figure out why.

Any pointers, code samples, links, etc. are appreciated.


Thanks for reading!