I have a form with multiple save buttons per customer request along with a few other buttons. When they click a save button, a confirm box opens. If they select cancel the intent is to prevent the form from submitting. However, when a user tries to select a save button other than the save button they just pressed nothing happens.
$("form").submit(function (e) {
var $btn = $(document.activeElement);
if ($btn.attr("value") == "Save") {
var c = confirm("Did you review the suicide related issues, signs and factors for currency?");
if (!c) {
$btn.css('filter', 'none');
e.preventDefault();
} else {
return true;
}
}
});