JSFiddle - React, Tailwind, and code Playground

by dieuhd

HTML

<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<a href="#" id="test" onclick="reloadPage(event)">Click Me</a>

<script>
$(document).ready(function() {

$(document).keydown(function(event){
    if(event.which==17)
        cntrlIsPressed = true;
});

$(document).keyup(function(){
    cntrlIsPressed = false;
});
});
var cntrlIsPressed = false;


function reloadPage(event)
{
		//event.preventDefault();
    if( event.which == 2 ) {
    	//todo something
      //window.open($("#test").attr("href"));
      alert("middle button"); 
      return false;
  	}
    if(cntrlIsPressed)
    {
         //window.open($("#test").attr("href"));
        alert("ctrl + click ");
        return false;
    }
    //todo something
    //window.location.href = $("#test").attr("href");
    alert("click");
    return true;
}
</script>