attributes란?
각 태그 이름(h1, input, a..) 안에 하늘색에 해당하는 부분이 attributes이다.
<a> 태그 안에 뭐 있나 보기
document.querySelector("a");
<a> 태그 안에 있는 모든 attributes 검색하기
document.querySelector("a").attributes;
href attribute에는 뭐 있나 보기
document.querySelector("a").getAttribute("href");
구글 클릭했는데 네이버 나오게 하기
href attribute 내용 바꾸기
'Java Script > DOM' 카테고리의 다른 글
DOM and Virtual DOM (0) | 2022.05.31 |
---|---|
JS]자바스크립트로 텍스트 조종하기 innerHTML vs textContent (0) | 2021.08.22 |
JS] 클래스 추가, 삭제, 토글/Structure, Style, Behaviour (0) | 2021.08.22 |
JS] 자바스크립트에서 css 변경하기 (0) | 2021.08.19 |
JS] 자바스크립트로 HTML element 선택하기 (0) | 2021.08.18 |
댓글