up.element up.element.jsonAttr(element, attribute)
JavaScript function

Reads the given attribute from the element, parsed as relaxed JSON.

Returns undefined if the attribute value is blank or only consists of whitespace.

Throws a SyntaxError if the attribute value is an invalid JSON string.


Parameters

element
required

The element from which to retrieve the attribute value.

Type: Element
attribute
required

The attribute name.

Type: string

Return value

The cast attribute value.

Type: Object | undefined