var number1=Math.ceil(Math.random()*9);
var number2=Math.ceil(Math.random() * 9);
var body=document.body;
var word=document.createElement('div');
var form=document.createElement('form')
var input=document.createElement('input');
var button=document.createElement('button');
var text=document.createElement('div');
word.textContent=`${number1} 곱하기 ${number2} 는?`;
body.append(word);
word.append(form);
form.append(input);
form.append(button);
button.textContent='확인'
form.addEventListener('submit',(e)=>{
e.preventDefault();
if(input.value==number1*number2){
alert('정답입니다')
number1 = Math.ceil(Math.random() * 9);
number2 = Math.ceil(Math.random() * 9);
word.textContent = `${number1} 곱하기 ${number2} 는?`;
input, value = '';
input.focus();
}
else{
input.focus();
alert('틀렸습니다')
}
})
이렇게 코드를 짜보았는데 똑같이한거같은데 전송을 하고나면
검색창과 버튼창이 사라집니다