Normally when click anchor tag it redirects to some url which is given inside the "href" attribute. Is there is any possiblity here for confirmation. When we click anchor tag it shows confirmation "Are you sure want to continue" if we clicked "yes" it gets redirect to that url which is given inside "href". if we click "no" it remains in same page. Please share any ideas you might have.
When we click anchor tag it shows confirmation "Are you sure want to continue" if we clicked "yes" it gets redirect to that url which is given inside "href". if we click "no" it remains in same page.
The confirm() method displays a dialog box with a message, an OK button, and a Cancel button. The confirm() method returns true if the user clicked "OK", otherwise false .
Try this
<a href="http://www.google.com" onclick="return confirm('Are you sure?')" >click here</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With