html5: Significance of attribute named required in checkbox/radio

前端 未结 4 740
暖寄归人
暖寄归人 2021-01-04 01:05

On form submission, how could you possibly mark a checkbox/radiobutton as required?

Source of inspiration: Pekka\'s answer to a question

4条回答
  •  耶瑟儿~
    2021-01-04 01:29

    I just tried it on a radio button in Firefox 4. Adding required to one radio input, then submitting before selecting one, triggers a "Please select one of these options" tooltip.

    E.g. this works:

    
    
    

提交回复
热议问题