html5: Significance of attribute named required in checkbox/radio

前端 未结 4 722
暖寄归人
暖寄归人 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:38

    Required checkboxes are not unusual. Practically every registration form uses some form of the "I have read and accept the User Agreement" checkbox.

    If you have Opera handy try out the code below. The form won't submit unless the checkbox is checked.

    
    
    
    
      html5
    
    
    
      

    html5 test

提交回复
热议问题