DEV Community

Vijay SRJ
Vijay SRJ

Posted on • Originally published at fullstackdeveloper.guru

Attribute vs Property in HTML

The terms attribute and property can be confusing in HTML.

For example the javascript framework Angular has the concepts Property Binding and Attribute Binding . Without knowing the difference between the two it is difficult to grasp the difference between those concepts.

The major difference between the two is this:

Attribute is related to HTML

Property is related to DOM

Other differences:

  1. Attribute and Property names are not always similar
  2. Changing Attribute/Property values doesn't always get reflected to the other
  3. Attribute is case sensitive , Property is not
  4. Attribute values are always strings , Property can be of different data types

Here is an explanation with examples:
Attribute vs Property

Top comments (0)