본문 바로가기

DEVLOG

검색하기
DEVLOG

  • 분류 전체보기 (114)
    • frontend (73)
      • log (9)
      • next.js (7)
      • react (25)
      • javascript (29)
      • css (2)
    • others (8)
      • server (3)
      • node (2)
    • dev log (33)
      • html canvas (2)
      • algorithm (31)
Guestbook
Today
Total
Notice
Recent Posts
Recent Comments
Link
관리 메뉴
  • 글쓰기
  • 관리

목록IE forEach (1)

DEVLOG

[Javascript] IE에서 forEach사용하기

IE에서는 document.querySelectorAll()과 같은 노드 배열에 관해서는 forEach메소드를 지원을 하지 않는다. 이럴 경우 해결법이 두가지가 있다. 1. 상단에 노드리스트에 관한 조건을 추가해준후 평소와 같이 사용한다. if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach; } 2. 배열 오브젝트에서 forEach메소드를 빌려 사용해야 한다 Array.prototype.forEach.call(요소리스트, 함수); var nodes = document.querySelectorAll(".node"); Array.prototype.forEach.call(..

frontend/javascript 2021. 2. 24. 11:00
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바