Skip to Content

Custom Control: Highlightable Text

Inspired by Sai’s blog Input: How to highlight suggestion items

It is common that we need to highlight text in table, list and other container controls. And we do not wish to iterate through all the items to highlight the text.

One way to handle this is to use a custom control and a model. The former is responsible for highlighting the text and the latter is responsible for informing the control what is the text to highlight.

Here is the JSBIN

JS Bin – Collaborative JavaScript Debugging

As an enhancement, we can alter this control to do underlining or/and handle regular expression for highlighting text.

Thanks

-D

Be the first to leave a comment
You must be Logged on to comment or reply to a post.