How to get id from div using onclick in lightning component - Domreysa

Post Top Ad

Post Top Ad

Thursday, December 20, 2018

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);

    }

No comments:

Post a Comment

Post Top Ad

Responsive Ads Here