0👍
window.onload = function() {} is just assigning this method to onload event of window and the code inside it will never run because onload has already been called.
You actually don’t need to write onload here. so your code would be something like this.
checkBirthday: function() {
let userBirthday = moment(this.userBday).format("MM DD, YYYY"),
resultBirtday = moment(this.results.BIRT_D).format("MM DD, YYYY");
if (userBirthday === resultBirtday) {
alert("CORRECT");
const btn = document.querySelector("#show-form");
const form = document.querySelector(".form");
const close = document.querySelector(".close-container");
btn.addEventListener("click", () => {
form.classList.add("form-show");
close.classList.add("x-show");
});
close.addEventListener("click", function() {
close.classList.remove("x-show");
form.classList.remove("form-show");
});
} else {
alert("WRONG");
window.stop();
}
}
- [Vuejs]-How to use Nuxt.js with socket.io/socket.io.-client?
- [Vuejs]-Vue dragula – drop event listener called multiple times
Source:stackexchange.com