JSFiddle - React, Tailwind, and code Playground

by Gereltod Gotsbayar

HTML

<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<a href="http://www.google.com" id="a_jquery" class="btn btn-success">jquery</a>
<a href="http://www.google.com" id="a_native" class="btn btn-primary">native</a>

CSS

:root {padding: 40px;}

JavaScript

// jquery
$(function(){
   
    $("#a_jquery").bind( "click", function(e) {
    	e.preventDefault();
    	alert($(this).attr("href"));
  });
})


// native 
var a_el = document.getElementById('a_native');

a_el.addEventListener('click', function(e) {
    alert(e.target);
    e.preventDefault();
}, false);