Correct way to do HTML5 checkbox

前端 未结 2 1007
醉话见心
醉话见心 2021-02-02 05:52

I can\'t seem to find an example anywhere... what\'s the correct way of doing a HTML5 checkbox?

2条回答
  •  逝去的感伤
    2021-02-02 06:39

    As far as I know and the docs state, nothing fundamental has changed. The basic markup is

    
    

    What is new is some interesting properties.

    • form - a reference to the form the control is associated with (nice!)
    • autofocus - to be focused as soon as the document is loaded (nice!)
    • required - require that it be checked (super nice! Although it isn't supported by Internet Explorer or Safari (yet).)

提交回复
热议问题