Set multiple element attributes at once on a passed DOM element.

Parameters:
NameTypeDescription
elHTMLElement

The element to apply the attributes to.

attrsobject

The attributes as object with key being attribute name, value being value.

Since
  • 1.0.0
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 );
}