Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

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

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

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

For this, follow the steps below:

  1. Paste the following code inside your Aura Component:
<a data-category="{!iterator.value1}" data-id="{!iterator.value2}" onclick="{!c.action}"> </a> 


2. 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"); }
Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *