Last updated on April 21st, 2022 at 02:43 pm

This tutorial shows you how to enable a javascript alert or confirmation box just before the link is being executed.

<script type="text/javascript">
function checkbox() {
  var confirmmessage = "Are you sure you want to continue?";
  var go = "";
  var message = "Action Was Cancelled By User";
  if (confirm(confirmmessage)) {
      window.location = go;
  } else {

The above code must appear between the and head tags of your HTML

<a href="#" onclick="checkbox()"> Click Me To Continue </a>

Interested in creating custom alert window using Javascript and jQuery?

Custom Popup Message Window Using Javascript(Screenshot Below)

Create custom alert window with themes using jQuery (Screenshot Below)


One thought on “Javascript Alert Message Box When Clicking A Link”

Leave a Reply

Your email address will not be published. Required fields are marked *