Skip to content

Glossary: JavaScript in the Browser

Attribute vs property

Also written: getAttribute, setAttribute, removeAttribute

An attribute is what is written in the HTML, and a property is the matching value on the element object. They don't always agree: link.getAttribute("href") gives what you wrote, while link.href gives the full address.

Where the book teaches it

Related terms

Boolean attribute