How to get id from div using onclick in lightning component

Component


<div data-account-id="{! account.Id }"  onclick="{! c.selectAccount }">click me</div>


Controller

selectAccount:  function (cmp, event, helper) {
        var id = event.currentTarget.dataset.accountId;
        console.log(id);
}

Comments

Popular posts from this blog

Privacy Policy

Query in Loop problem: ( we do not need to to select query in loop )

How to set up vscode with salesforce sandbox