HTML - Why boolean attributes do not have boolean value?

前端 未结 7 863
小蘑菇
小蘑菇 2020-12-03 10:41

I noticed that some elements have attributes which are boolean. I wonder why the values are not true or false? or 1 and 0? Are there any reason behind why they are like this

相关标签:
7条回答
  • 2020-12-03 11:16

    As vc74 has said, it doesn't matter what value you have for selected or disabled.

    <option selected="selected">Ham Burger</option>

    will do the same as

    <option selected="sjkhdaskj">Ham Burger</option>

    0 讨论(0)
提交回复
热议问题