DEV
-
jQuery Checkbox 체크된 요소 선택하기(선택자)DEV/javascript 2022. 4. 20. 18:53
Javascript 에서 체크 박스의 체크된 요소를 선택해야 하는 일이 생긴다. 사용법은 간단하다 :) $('input[type="checkbox"]:checked'); 혹시 필요하실까요...? https://seokbong.tistory.com/71 jQuery Checkbox 하나만 선택할 수 있게 하기 Javascript 사용 시, Input Checkbox를 하나만 선택이 가능하게 해야 할 때가 있다. 다음과 같이 사용이 가능하다. (모든 체크박스를 기준으로 한다. 필요하다면 식별자로 뽑아서 쓰도록 하자) // 체크박 seokbong.tistory.com https://seokbong.tistory.com/8
-
jQuery Checkbox 하나만 선택할 수 있게 하기DEV/javascript 2022. 4. 20. 18:47
Javascript 사용 시, Input Checkbox를 하나만 선택이 가능하게 해야 할 때가 있다. 다음과 같이 사용이 가능하다. (모든 체크박스를 기준으로 한다. 필요하다면 식별자로 뽑아서 쓰도록 하자) // 체크박스 하나만 선택 가능하게... $(document).on('click', "input[type='checkbox']", function(){ if(this.checked) { const checkboxes = $("input[type='checkbox']"); for(let ind = 0; ind < checkboxes.length; ind++){ checkboxes[ind].checked = false; } this.checked = true; } else { this.checked =..
-
Javascript Object 내부 날짜(Date) 오름차순/내림차순(sort, reverse) 하기DEV/javascript 2022. 4. 20. 18:31
Javascript를 사용하면 다양한 Object를 다루게 된다. 오늘 Object 내부에 있는 날짜(Date)를 내림차순으로 정리해달라는 부탁을 받았다. // 데이터 const arr = { list1: [ {"date":"2022-02-10 11:20", "name":"Seokbong", "age":"29"}, {"date":"2022-02-10 11:15", "name":"Sibong", "age":"29"}, {"date":"2022-02-10 11:18", "name":"DDobong", "age":"29"} ], } list1의 데이터를 정렬한다고 가정하자. // 오름차순 function sortDate1(list) { const sorted_list = list.sort(function(a,..
-
Node js "command not found: nodemon"DEV/node js 2022. 4. 18. 19:30
nodemon [앱 이름] 위와 같이 nodemon을 실행했는데 에러가 발생하는 경우... npm을 통해 nodemon을 설치했음에도 불구하고 에러("command not found: nodemon")가 발생하는 경우 (특히 -D 옵션을 통해 설치한 경우) 두 가지 방법 1. npx npx nodemon [앱 이름] 2. global // global 설치 npm install -g nodemon // Permission 경고가 발생하는 경우는 아래와 같이 sudo npm install -g nodemon (global은 최대한 피하는게 좋다고...) * 추가 global 리스트 확인 : npm list -g --depth=0 global 제거 : npm uninstall -g * 추가 3. script..
-
Node js 노드 시작하기 9 : npm의 버전 및 명령어DEV/node js 2022. 4. 18. 19:23
해당 글은 시리즈로 작성되었습니다. https://seokbong.tistory.com/category/DEV/node%20js 'DEV/node js' 카테고리의 글 목록 까먹으니까 적어두자... seokbong.tistory.com * npm 사용하기 : https://seokbong.tistory.com/63 Node js 노드 시작하기 8 : npm 사용하기 해당 글은 시리즈로 작성되었습니다. https://seokbong.tistory.com/category/DEV/node%20js 'DEV/node js' 카테고리의 글 목록 까먹으니까 적어두자... seokbong.tistory.com 오늘은 Node js 의 패키키 및 버전을.. seokbong.tistory.com 저번 시리즈에 이어서 ..