function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shruti VishShruti Vish 

I want to get the Id from lightning component

<button class="slds-button slds-button--icon-border slds-float--left"  aria-live="assertive"  type="button" onclick="{!c.test}" value="{!ideas.Id}">
                                    <c:svgIcon svgPath="/resource/slds221/assets/icons/utility-sprite/svg/symbols.svg#like" category="utility" size="small" name="down" class="slds-button__icon slds-button__icon--large" />
                                    <span class="slds-assistive-text" id="like"  title="like">Like</span>
                                </button>

javascript code

  test:function(cmp,event){ 
      var ideaID = event.currentTarget.dataset.ideasID;
      alert(ideaID);
        
    }
NagendraNagendra (Salesforce Developers) 
Hi Shradha,

A component has two types of IDs: a local ID and a global ID. You can retrieve a component using its local ID in your JavaScript code. A global ID can be useful to differentiate between multiple instances of a component or for debugging purposes.

To find the local ID for a component in JavaScript, use cmp.getLocalId().

To retrieve a component’s global ID in JavaScript, use the getGlobalId() function.

For detailed information please check with below link: Hope this helps.

Please mark this as solved if it's resolved.

Thanks,
Nagendra.