Skip to main content

ASPxClientHtmlEditor.HighlightText(text, searchContainer) Method

Highlights the text with the specified text color and background color.


static HighlightText(
    text: string,
    searchContainer: any,
    color?: string,
    backgroundColor?: string
): void


Name Type Description
text string

A string value specifying the text to be highlighted.

searchContainer any

An object specifying the container where the specified text should be searched.

color string

A string value specifying the text color.

backgroundColor string

A string value specifying the background color.


// highlights all 'word1' entries inside a DOM element
var searchText = "word1";
var mailViewNavBarElement = document.getElementById(...);
var cssClassForFoundEntriesDecoration = "highlight-search";
ASPxClientHtmlEditor.HighlightText(searchText, mailViewNavBarElement, cssClassForFoundEntriesDecoration);

// removes highlighting
ASPxClientHtmlEditor.HighlightText(null, mailViewNavBarElement);
See Also