Edit this page

up.element up.element.setAttrs(element, attributes)
JavaScript function

Sets properties from the given object as attributes on the given element.

Example

up.element.setAttrs(element, { title: 'Tooltip', tabindex: 1 })

element.getAttribute('title') // result: "Tooltip"
element.getAttribute('tabindex') // result: "1"

Parameters

element
required

The element on which to set attributes.

attributes
required

An object of attribute names and values to set.

To set an empty attribute, pass an empty string value.

To remove an attribute, use a value of null or undefined.