4,090
edits
No edit summary |
No edit summary |
||
Line 1,177: | Line 1,177: | ||
document.addEventListener("DOMContentLoaded", function() { | document.addEventListener("DOMContentLoaded", function() { | ||
console.log("DOM fully loaded and parsed."); | |||
var submitButton = document.querySelector('#submit'); | var submitButton = document.querySelector('#submit'); | ||
console.log("Submit button:", submitButton); | |||
if (submitButton) { | if (submitButton) { | ||
submitButton.addEventListener('click', function(event) { | submitButton.addEventListener('click', function(event) { | ||
console.log("Submit button clicked."); | |||
event.preventDefault(); // Prevent the default link behavior | event.preventDefault(); // Prevent the default link behavior | ||
Line 1,200: | Line 1,204: | ||
'?subject=' + encodeURIComponent(subject) + | '?subject=' + encodeURIComponent(subject) + | ||
'&body=' + encodeURIComponent(body).replace(/%20/g, ' '); | '&body=' + encodeURIComponent(body).replace(/%20/g, ' '); | ||
console.log("Generated mailto link:", mailtoLink); | |||
window.location.href = mailtoLink; | window.location.href = mailtoLink; | ||
}); | }); | ||
} else { | |||
console.warn('#submit button not found on this page.'); | |||
} | } | ||
}); | }); | ||
}); | }); |