Searches for HTML elements with the data-ref attribute.
Returns an object whose key is the data-ref attribute value and whose value is the HTML element.
Reference
Parameters:
rootElement: string|JQuery|HTMLElement
Selector, element, or jQuery object of the search source context. Default is document.body.
options.asHtmlElement?: boolean
If true, the element collection is obtained as an HTML element; if false, the element collection is obtained as a JQuery object. Default is false.
Return:
[key: string] any The key is the data-ref attribute value and the value is the HTML element object.
Basic
Search for HTML elements. An object whose key is the data-ref attribute value and whose value is the jQuery element is returned as the result.
import {components} from 'metronic-extension';
// Get references to elements with data-ref attributes.
const ref = components.selectRef('body', {asHtmlElement: true});