When I change which one is first and which one is second they work fine individually however not at the same time.
window.onload = () => {
document.getElementById("drop_up").addEventListener("click", function() {
const menue = document.getElementById("header");
if (menue) {
if (menue.style.display === "none") {
menue.style.display = "block";
this.textContent = "hide";
} else {
menue.style.display = "none";
this.textContent = "show";
}
}
});
document.getElementById("continue").addEventListener("click", function() {
const card = document.getElementById("card").value;
const ccv = document.getElementById("ccv").value;
const selectedMonth = parseInt(document.getElementById("month").value);
const cardPattern = /^(51|52|53|54|55).{14}$/;
const ccvPattern = /^.{3,4}$/;
const today = new Date();
const currentMonth = today.getMonth() + 1; // Get current month (1-indexed)
if (card.match(cardPattern) && ccv.match(ccvPattern) && (selectedMonth >= currentMonth)) {
window.location.href = "sucsess.html";
} else {
alert("Card details incorrect, try again");
}
});
};
New contributor
Turtle is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.