form1 [자바스크립트] form, input 이벤트 핸들링 목표 입력된 값을 console에 뽑아 보기 html 파일 이벤트 헨들링 html 결과 JavaScript 파일 // input 창에 입력된 값 읽어와 주게 설정을 해주었다. function App() { document.querySelector('#menu-name').addEventListener('keypress', (e) => { console.log(e.key); }); } // document.querySelector('') -> html에 있는 element를 찾을 수 있다. // addEventListener('', (e)=>{}) -> 찾은 element에서 이벤트를 받아 올 수 있다. 입력창에 입력을 해도 console에 나타나지 않는다. 그 이유는 function App을 선언만하고 .. 2022. 3. 12. 이전 1 다음 728x90