Abraham P
Abraham P

Reputation: 15481

what is the open attribute

I've run across the open attribute like so:

 $.attr('open')

Or like so: <div open='whatever'></div>

I can't seem to find documentation for this attribute. What does it do?

Upvotes: 1

Views: 349

Answers (1)

kapa
kapa

Reputation: 78751

It is used on a <details> element, so your example with the <div> is not correct.

HTML5 Spec says:

The open content attribute is a boolean attribute. If present, it indicates that both the summary and the additional information is to be shown to the user. If the attribute is absent, only the summary is to be shown.

When the element is created, if the attribute is absent, the additional information should be hidden; if the attribute is present, that information should be shown. Subsequently, if the attribute is removed, then the information should be hidden; if the attribute is added, the information should be shown.

Upvotes: 4

Related Questions