unmark() method
Syntax
// javascript
const instance = new Mark(context);
instance.unmark([options]);
// jQuery
$(context).unmark([options]);
Parameters:
optionsobject - Optional options:
| Option | Type | Default | Description |
|---|---|---|---|
element | string | 'mark' | Specifies marked elements to remove.
Note: if other than the default marked element is used, e.g. span, it must be also specified in the unmark() method. It is also possible to use \* in case of using different marked elements to unmark in one run. A mark.js library uses a default selector \*[data-markjs] but it is not safe to apply to all HTML elements. |
className | string | '' | Remove only marked elements with specified class name. |
exclude | string or string[] | [] | A string or an array of selectors. Specifies the DOM elements that should be excluded from removing highlighting. |
shadowDOM | boolean | undefined | Whether to remove highlighting inside shadow DOMs
See Highlighting in shadow DOM for more details. |
iframes | boolean | false | Whether to remove highlighting inside iframes |
iframesTimeout | number | 5000 ms | The maximum time to wait for an iframe to load before skipping |
debug | boolean | false | Whether to log messages |
log | object | console | Log messages to a specific object |
done | function | A callback after highlighting was removed
done: () => {} It has no parameters. |
Example with default options values
const options = {
element: 'mark',
className: '',
shadowDOM: false,
iframes: false,
iframesTimeout: 5000,
done: () => {},
debug: false,
log: window.console
};
JavaScript:
var instance = new Mark(document.querySelector('selector'));
instance.unmark(options);
jQuery:
$('selector').unmark(options);