예제
<a title ="getAttribute example">
document.querySelector('a').getAttribute('title');
사용법
-
Element의 해당요소 Attribute 값을 반환합니다
-
예제에서 a 태그의 Attribute인 title 값="getAttribute example"을 반환합니다
-
만약 주어진 Attribute가 존재 하지 않는 다면, null 값이나 ""(빈문자열)을 반환합니다
참고)
MDN Element.getAttribute()