본문 바로가기

전체 글164

Delete local storage data *appendChild() The Node.appendChild() method adds a node to the end of the list of children of a specified parent node. *parentNode The Node.parentNode read-only property returns the parent of the specified node in the DOM tree. *removeChild() The Node.removeChild() method removes a child node from the DOM and returns the removed node. https://www.w3schools.com/jsref/met_node_removechild.asp HTM.. 2020. 2. 17.
새로운 데이터 값 id 주기 JSON, array.length + 1 const toDos = [ ] => toDos.length => 0 const newId = toDos.length + 1; const toDoObj = { text: text, id: newId // if there isn't anything, it starts from 0 }; const toDoForm = document. querySelector(".js-toDoForm"), toDoInput = toDoForm. querySelector("input"), input value 를 주고 난 후, 그 자리 데이터를 지운다. const currentValue = toDoInput. value; *toDoInput. value = " "; forEach를 통해 데이터 값들을 화면에 뿌려준다. // 뿌.. 2020. 2. 16.
Math.floor(Math.random() * (max - min)) + min 범위 구하기. Math.random() generates a random number between 0 and 1 (not including 1). You need to scale that value based on the range of numbers you want. Your range is how far from your min desired number to your max desired number which is max - min. If you want to include the max value in the range of numbers generated, then use max - min + 1 You then need to make sure the random number starts at the ri.. 2020. 2. 15.
회원가입 DOM, form validation 설계 회원가입 특정 값은 반드시 입력해야 합니다 비밀번호는 특정 자릿수 이상이어야 하며, 숫자나 특수문자를 반드시 요구하기도 합니다 비밀번호와 비밀번호 확인란이 동일해야 합니다 신용카드 넘버가 유효한지 확인하는 경우도 있습니다 이제 버튼을 클릭했을 때, (혹은 실시간으로) 그 입력값이 유효한지 아닌지 판단하는 JavaScript 함수를 연결시켜 봅시다. 이를 유효성 검사(form validation)라고 하며, 실제 개발 과정에서 정말 많이 부딪히는 문제 중 하나입니다. 이번 시간에는 유효성 검사를 직접 구현해봅니다. 버튼 클릭등의 이벤트를 발생시키고, DOM을 통해 값을 얻어내고, 함수를 연결시키는 과정을 연습해봅시다. Achievement Goals 단순 입력, 체크박스, 라디오 버튼 등의 입력을 받을 수.. 2020. 2. 14.