我正在尝试用你永远无法正确回答的存在问题建立一个验证码。我想我不小心破坏了我的 Javascript 代码,因为它不再提交任何答案。
这是我的代码:
var text2 = "this is the second question";
//This is the submit button and its interactions
var submit = document.querySelector(".submit");
var message = document.querySelector(".message");
var question = document.querySelector(".question");
submit.addEventListener("mousedown", function (event) {
message.classList.add("active");
setTimeout(function () {
question.innerText = text2;
message.classList.remove("active");
}, 5000);
});
//This is the reload button and its interactions
var reload = document.querySelector(".reload");
setTimeout(function () {
location.reload();
}, 5000); // change the time to 5000ms (5 seconds)
var input = document.querySelector(".input-1");
var currentAnswer = "";
input.addEventListener("keyup", function (event) {
currentAnswer = input.value;
console.log(currentAnswer);
});
我试图在按下提交按钮后 5 秒后重新加载页面,但现在我无法提交任何内容。五秒后它也没有重新加载。