What kind of attributes is a boolean attribute?

I can check whether the attribute is boolean or not, but it’s difficult to keep that in memory. I feel, one of the causes is that I’m not sure what kind of attributes is boolean. So, I’m looking for a list of these attributes, but I can’t find it for now. Is there any page including such a list? Or, do these attributes have something in common?

Getting started with HTML”, Attributes > Boolean Attributes

Hi @user-p

There aren’t too many. This blog post lists 26: https://meiert.com/en/blog/boolean-attributes-of-html/. The ones you probably use most are some of the form control attributes: checked, disabled, required, selected.
Generally, you can read the attribute as a question. If you can answer “Yes” or “No”, it’s a boolean attribute:

  • Should this “input” be disabled? Yes
  • Should I allowfullscreen? No

I hope that helps. :slightly_smiling_face:

Have a nice Weekend,
Michael

1 Like

Hello @mikoMK, I appreciate the useful info and tip.

1 Like