My current code:
<a href="chrome://inducebrowsercrashforrealz" target="_blank">DONT PRESS ME!</a>
<br/>
CodePudding user response:
This works for me, usually:
<a style="cursor: pointer" onclick="alert('Hello')">DONT PRESS ME!</a>
CodePudding user response:
As I think you want something like this. When some user clicks a button or linked line it should be trigger an alert rather than redirecting that user to another linked site. So, the code should be like this. This code contains both HTML and JavaScript.
HTML
<a href="" id="linkUrl">DONT PRESS ME!</a>
JS
var link = document.getElementById("linkUrl");
link.onclick = function(){
event.preventDefault();
alert("Warning!");
}
Hope this helps. Let me know about your progress.