No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Component IDs
Local IDs
A local ID is unique within a component and is only scoped to the component.
Create a local ID by using the aura:id attribute. For example:
Find the button component by calling cmp.find("button1"), where cmp is a reference to the component containing the button.
aura:id doesn't support expressions. You can only assign literal string values to aura:id.
For more information, see the JavaScript API at https://<mySalesforceInstance>.lightning.force.com/auradocs/reference.app, where <mySalesforceInstance> is the name of the instance hosting your org; for example, na1.
Global IDs
Every component has a unique globalId, which is the generated runtime-unique ID of the component instance. A global ID is not guaranteed to be the same beyond the lifetime of a component, so it should never be relied on for tests.
To create a unique ID for an HTML element, you can use the globalId as a prefix or suffix for your element. For example:
You can use the getGlobalId() function in JavaScript to get a component's global ID.
You can also do the reverse operation and get a component if you have its global ID.