This commit is contained in:
Oliver
2025-10-04 18:43:39 -03:00
parent 12b888a678
commit b33b93d3b7

View File

@@ -137,18 +137,22 @@ function handleFormSubmit() {
});
}
function attachButtons() {
const buttons = Array.from(document.querySelectorAll("button, a"));
// Select all <a> or <button> elements that include "Try Now" in text
const buttons = Array.from(document.querySelectorAll("a, button"));
buttons.forEach(btn => {
if (btn.textContent.trim() === "Try Now") {
if (btn.textContent && btn.textContent.trim() === "Try Now") {
btn.addEventListener("click", (e) => {
e.preventDefault();
openModal();
e.preventDefault(); // Prevent link jump
const modal = document.getElementById("buyNowModal");
if (modal) modal.style.display = "flex";
});
}
});
}
document.addEventListener("DOMContentLoaded", () => {
createModal();
handleFormSubmit();