Confirm onclick


/ Published in: JavaScript
Save to your folder(s)

Ask the user with a confirmation dialog if the link should be followed or not.


Copy this code and paste it in your HTML
  1. function conf()
  2. {
  3. return confirm('Are you sure?');
  4. }
  5.  
  6. <a onclick='return conf()' href='http://example.com'>Link</a>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.