Set multiple element attributes at once on a passed DOM element.
Parameters:
Name | Type | Description |
---|---|---|
el | HTMLElement | The element to apply the attributes to. |
attrs | object | The attributes as object with key being attribute name, value being value. |
- Since
- 1.0.0
- Source
Returns:
- Type:
- void
Example
import { setAttributes } from "@gravityforms/utils";
function Example() {
const node = getNodes( 'example' )[ 0 ];
const attributes = {
'aria-hidden': 'true',
'id': 'example',
};
setAttributes( node, attributes );
}