Get attribute value (Beta)
Get attribute value (Beta)
Get attribute value (Beta)
element.getAttributeValue(name) / element.getAttributeValue(index)Get the value of a single attribute on an element.
You can look up the attribute by its name string or by its zero-based index in the attributes array.
The returned value may be a plain string or a BindingValue when the attribute value is bound to a variable or component prop.
To get the resolved string value with any binding evaluated, use element.getResolvedAttributeValue().
These methods are in public beta and may change with future releases.
name : string — The name of the attribute whose value to retrieve.index : number — The zero-based position of the attribute in the element’s attributes array.Promise<string | BindingValue | null>
A Promise that resolves to the attribute value, a BindingValue if the value is a binding reference, or null if no attribute with the given name or index exists.
Checks for authorization only.