It's best to use addEventListener(). You can add all types of events. example: "click","mousemove" and many more. the false at the end is to stop the event from traversing up the DOM tree. By setting the 3rd property to true the event will continue to traverse the DOM tree so that parent elements will also receive the event. This also makes removing events just as simple as adding events using removeEventListener().
adding event
element.addEventListener(event, function, useCapture)
removing event
element.removeEventListener(event, function, useCapture)
event:  Required. A String that specifies the name of the event.
function:   Required. Specifies the function to run when the event occurs. 
useCapture  Optional. A Boolean value that specifies whether the event should be executed in the capturing or in the bubbling phase. 
Possible values:
true - The event handler is executed in the capturing phase
false- Default. The event handler is executed in the bubbling phase
This example requires no JavaScript libraries. This is just plain old JavaScript and will work in every browser with nothing extra needed. 
   <!DOCTYPE html>
    <html>
    <head>
    <title>exampe</title>
    </head>
    <body>
        <a id="test" href="">test</a>
    <script>
        document.getElementById("test").addEventListener("click", function(){
            alert('hello world');
        }, false);
    </script>
    </body>
    </html>
You can read more about this with the following links: 
If you would like to use JQuery methods to handle a click event you can do the following.
Using .click()
$("#target").click(function() {
  alert("Handler for .click() called.");
});
More info here: https://api.jquery.com/click/
Using .on()
$("#target").on("click", function() {
  console.log($(this).text());
});
More info here: http://api.jquery.com/on/