0

I want this link to have a JavaScript dialog that asks the user “Are you sure? Y/N”.

<a href="?status=1">My Link</a>

If the user clicks “Yes”, the link should load, if “No” nothing will happen.

What is the easiest way to do this?

There are several ways to do this, but I have forgotten the easiest way

Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
jadipelus
  • 13
  • 1

1 Answers1

0

Check this link

But I introduced the simplest inline methods below

<a href="?status=1" onclick="return confirm('Are you sure?')">My Link</a>

And

<a href="?status=1" onclick="if(confirm('Are you sure?')) {return true} ; else {return false};">My Link</a>
amir roox
  • 16
  • 2