How to show confirm dialog when click a hyperlink in javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dagam3rz
    New Member
    • Jul 2010
    • 11

    #1

    How to show confirm dialog when click a hyperlink in javascript

    I want to as the user to confirm if he really want to view the page. So what how would I do that in javascript.

    Thanks in advance and have a great day!
  • improvcornartist
    Recognized Expert Contributor
    • May 2007
    • 303

    #2
    You could use the javascript confirm function. For example, to confirm a link you should be able to do something like
    Code:
    <a href="http://bytes.com" onclick="return confirm('Are you sure?');">Bytes</a>

    Comment

    Working...