Returns the given attribute value for the given element.
If the element does not have the given attribute, it returns undefined.
This is a difference from the native Element#getAttribute(), which mostly returns null in that case.
If the element has the attribute but without a value (e.g. <input readonly>), it returns an empty string.
The name of the attribute to read.
The attribute value.
Returns undefined if the attribute is not set on the given element.
Tip Your coding agent can search these docs locally with the Unpoly agent skill