Appearance
Function: highlightElement()
ts
function highlightElement(
ctx: Context,
selectors: string | string[],
options?: {
color?: string;
blink?: boolean;
}): Promise<{
remove: () => Promise<void>;
}>;Defined in: src/highlight/highlightElement.tsx:149
Highlight one or more elements on the page.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selectors | string | string[] | A single selector or an array of selectors (CSS or XPath). |
options? | { color?: string; blink?: boolean; } | Color and blink settings. |
options.color? | string | - |
options.blink? | boolean | - |
Returns
Promise<{ remove: () => Promise<void>; }>
An object with a remove method to clear the highlights.
Example
ts
const highlight = await highlightElement(ctx, '#shipping-address', { color: '#2196F3' });
// Later, remove it
await highlight.remove();