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?
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: