The onClick event attribute is used to catch the click event of a pointing device.
The onClick attribute can be used to determine when a HTML element is clicked, which makes it possible to turn ordinary elements into clickable buttons. Doing this can however present usability issues, so it may be best to avoid using it on anything else than links and buttons.
The below shows how to use the onclick event on a button element, to throw out a basic alert box.
<button onclick="alert('Dont poke me. Just dont. Im just not in the mood!');">Don't poke me!</button>