Getting the ID of an element with plain JavaScript

I was searching for this for very long and didn’t really found something useful unless using a¬†JavaScript¬†framework, but for those who want to learn to code from scratch this is the answer. First you have to get the element that triggers an event. example: HTML <div id=”hello” onclick=”getId();”></div> <!– in Firefox is necessary to include […]