View
<form>안에 <button>태그가 있는 경우에는
<button>클릭시 기본적으로 페이지가 reload된다.
이를 막기 위해서는 아래와 같이
자바스크립트로 preventDefault 로 기본동작을 막을 수 있다.
버튼.addEventListener('click', function(e)) {
e.preventDefault();
});
혹은
button 태그에 type속성을 button으로 주면 페이지가 새로고침되지 않는다.
<button type="button">
https://stackoverflow.com/questions/1878264/how-do-i-make-an-html-button-not-reload-the-page
reply