HTML

HTML 에서의 attribute와 property

ToKor 2021. 1. 21. 02:32

사전적 정의로 attribute는 특성, preperty는 자산,특질

attribute: 정적이며, html문서에 존재

property: 동적으로, Dom tree에 존재 (Dom Tree 에서 attribute에 대한 표현)

 

<p class="myClass" id="name">Jeo</p>

<p></p>: Tag

class, id: attribute

myClass, name: attribute의 value

Jeo: Content

전체: element

 

이를 Dom Tree에서 확인하면 값이 myClass인 className이라는 property가 존재한다.

예를들어, 체크박스에 체크를해서 값을 변경할때, attribute의 값은 변하지 않지만,

attribute는 동적으로 변화한다.