Set DOM ID (Beta)
Set DOM ID (Beta)
element.setDomId(domId)
Set the HTML id attribute of an element, or bind it to a data source.
Verify that the element has the domId property before calling this method.
Beta
These methods are in public beta and may change with future releases.
Syntax
Related types:
Parameters
domId:string | BindingInput— The HTMLidvalue to set on the element. The value must be a valid HTML ID; invalid characters are rejected with an error that suggests a corrected version (for example,"has spaces"is rejected with a suggestion of"has-spaces"). Reserved IDs that conflict with browser APIs (such as"top"and"self") are also rejected. Pass aBindingInputobject to bind the ID to a data source such as a CMS field or component prop.
Returns
Promise<null>
A promise that resolves to null on success.
Throws an Error if the value is not a valid HTML ID, the element is not found, or the value is neither a string nor a BindingInput object.