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') // => "Tooltip"
element.getAttribute('tabindex') // => "1"

Parameters

element Element

The element on which to set attributes.

attributes Object

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.