JSFiddle - React, Tailwind, and code Playground
by nunnakirankumar
HTML
<div>
<input type="button" id="b1" value="Disable Yahoo Link">
<input type="button" id="b2" value="Enable Yahoo Link">
</div>
<a id="yahoo" target="_blank" href="http://yahoo.com" onclick="javascript:alert('onclick alert')">Yahoo.com</a>
JavaScript
$("#b1").click(function(){
$("#yahoo").attr("disabled","disabled");
$("#yahoo").css("background-color","silver");
})
$("#b2").click(function(){
$("#yahoo").removeAttr("disabled");
$("#yahoo").css("background-color","white");
})
$("#yahoo").click(function(e){
if($("#yahoo").attr("disabled")=="disabled") {
e.preventDefault();
}
});