How to send two values/Id from Aura component to Javascript Controller in Salesforce!





We might struggle sometimes to send data or mostly Id on an onclick event from Aura Component to the Javascript Controller class.

For this, first, paste the following code inside your Aura Component:

<a data-category="{!iterator.value1}" data-id="{!iterator.value2}" onclick="{!c.action}"> </a>
Afterward, paste the following code in the JS controller:action: function (component, event, helper) { let cat = event.target.getAttribute("data-category"); let id = event.target.getAttribute("data-id"); }

Comments