How to Get On click Data id using getAttribute() method ?

In this tutorial I’m going to learn how to get onclick get data id using JavaScript get id of the element that has the onclick event. javascript…