Miva Merchant Development by Scot's Scripts

JS: Confirm Click with Custom PopUp Message

Miva Random Code Trivia

Want to start an online store? We work with you from start to finish, from commerce platform to design to SEO.
Experience counts, and we have a lot.

WARNING:

This information is offered "AS IS" for internal reference only. Use at your own risk.
Does AI actually understand your Miva Merchant store? Our smart JSON-LD schema generator makes sure it does. Contact us to get started. (more info)
SEO Audit & Inquiries • News & Updates • SEO for Miva Merchant

JS: Confirm Click with Custom PopUp Message

THIS CODE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED;
THE AUTHOR DISCLAIMS ALL LIABILITY FOR ANY DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR STORE DISRUPTIONS ARISING FROM ITS USE.

Scot Ranney • February 20, 2026 (updated: August 07, 2026)


This is a slick little jquery bit that gives you a browser popup to confirm your click. Used on modules or in templates.

Includes a way to customize the message.

HTML

First, here's a basic link with a simple default "are you sure?" confirmation message:

<a class="confirmclick" href="something.html">Delete Everything!</a>

This will bring up "Are you sure?"

This link has a custom popup message:

<a class="confirmclick" data-msg="The frogs will be unhappy." href="something.html">Delete all lilly pads</a>

Vanilla JS

The js to handle this is short and simple. It either takes the message you put in data-msg or it defaults to "Are you sure?"

<script>
document.addEventListener('click', function (e) {
	var el = e.target.closest('.confirmclick');
	if (!el) return;
	var msg = el.dataset.msg || 'Are you sure?';
	if (!confirm(msg)) {
		e.preventDefault();
	}
});
</script>

https://www.scotsscripts.com/mvblog/jquery-confirm-click-with-custom-popup-message.html

js