Newer Version Available
Finding Components by ID
Retrieve a component by its ID in JavaScript code. For example, you can add a local ID of button1 to the ui:button component.
1<ui:button aura:id="button1" label="button1"/>You can find the component by calling cmp.find("button1"), where cmp is a reference to the component containing the button. The find() function has one parameter, which is the local ID of a component within the markup.
You can also retrieve a component by its global ID, which is an ID generated
during runtime.
For example, the ui:button component renders as an
HTML button element with this
markup.
Retrieve the component by using $A.getComponent("30:463;a").
1var cmp = $A.getComponent(globalId);1<button class="default uiButton" data-aura-rendered-by="30:463;a">...</button>