문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
wiki:javascript:javascript_note:getattribute_method [2021/06/08 08:55] emblim98 만듦 |
wiki:javascript:javascript_note:getattribute_method [2023/01/13 18:44] (현재) |
||
---|---|---|---|
줄 9: | 줄 9: | ||
\\ | \\ | ||
=====The source of the article==== | =====The source of the article==== | ||
- | [[https:// | + | [[https:// |
====Example==== | ====Example==== | ||
+ | %%< | ||
+ | <code javascript> | ||
+ | < | ||
+ | <h1 class=" | ||
+ | < | ||
+ | <button onclick=" | ||
+ | <p id=" | ||
+ | <!-- democlass --> | ||
+ | < | ||
+ | function myFunction() { | ||
+ | var x = document.getElementsByTagName(' | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | =====Definition and Usage===== | ||
+ | %%getAttribute()%% 메서드는 요소의 지정된 이름을 가진 속성 값을 반환합니다.\\ | ||
+ | \\ | ||
+ | **Tip:** 속성(attribute)을 %%Attr%% 객체로 반환하려면, | ||
+ | =====Syntax===== | ||
+ | <code javascript> | ||
+ | element.getAttribute(attributename) | ||
+ | </ | ||
+ | =====Parameter Values===== | ||
+ | | Parameter | ||
+ | | attributename | ||
+ | |||
+ | =====Technical Details===== | ||
+ | ^ Return Value ^ 문자열이며 특정 속성 값을 표시합니다. | ||
+ | | | **Note:** 속성이 존재하지 않을 경우, 반환 값은 null 또는 비어있는 문자열("" | ||
+ | |||
+ | =====More Examples===== | ||
+ | |||
+ | ====Example==== | ||
+ | %%< | ||
+ | |||
+ | <code javascript> | ||
+ | < | ||
+ | Read about the <a href=" | ||
+ | |||
+ | < | ||
+ | |||
+ | <button onclick=" | ||
+ | |||
+ | <p id=" | ||
+ | <!-- _blank --> | ||
+ | |||
+ | < | ||
+ | function myFunction() { | ||
+ | var x = document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ====Example==== | ||
+ | %%< | ||
+ | <code javascript> | ||
+ | < | ||
+ | < | ||
+ | |||
+ | <button id=" | ||
+ | |||
+ | <p id=" | ||
+ | <!-- myFunction() --> | ||
+ | |||
+ | < | ||
+ | function myFunction() { | ||
+ | var x = document.getElementById(' | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
{{tag> | {{tag> |