Confirm an action using Javascript


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

When a link is clicked, call up this function.

Parameter
message = message you want to display after click
url = page you want to forward to if the user clicks OK


Copy this code and paste it in your HTML
  1. function confirmMessage(message, url) {
  2. if (confirm(message)) {
  3. location.href = url;
  4. }
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.