Value Binding with html elements in lightning Component

HTML Markup:

<a href="javascript:void(0)" onclick="{!c.onUserClick}" data-userid="{!AccountDetail.CreatedBy.Id}">

onUserClick : function(component,event,helper){
        var userId = event.currentTarget.getAttribute("data-userid");
        var navEvt = $A.get("e.force:navigateToSObject");
            "recordId" : userId,

Written by 

Salesforce MVP | Lightning Champion | 17x Salesforce Certified | Application Architect | 7x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

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