This article will help you to create link over any text you have used in your webpage without using anchor tags of html .
Also whenever you will click on link it will ask you to confirm whether you want to continue or not ...
Step 1
We know Browser know our current workspace and JavaScript is the best way to communicate with browser . So with this command
document.location="delete_me.html"
JavaScript can ask for your current location from Browser .
Step 2
We have confirm dialog box in JS confirm()
which gives its o/p as Boolean values . These values can be used with if and else conditions .
Code:
<script>
function abc(){
var c= confirm("Do you want to Continue....?? ");
if(c)
{
document.location="delete_me.html";
}
else
{
alert("we stay here");
}
}
</script>
<body>
<div onclick=abc()>Click me </div>
</body>
Top comments (2)
very simple...
Thank you for your valuable suggestion . And I Have recently started my JavaScript journey and so I got to learnt a lot from your feedback . 😁