正确的方式来做HTML5复选框 [英] Correct way to do HTML5 checkbox

查看:91
本文介绍了正确的方式来做HTML5复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在任何地方找到示例......做HTML5复选框的正确方法是什么?

解决方案

据我所知和文档状态,没有任何根本性改变。基本的标记是:

pre $ < input name =your_namevalue =your_valuetype =checkbox>

新增功能是一些有趣的属性。



< ($!$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $' code> autofocus - 在文档加载后立即集中(很好!)
  • 必填 - 要求它被检查(超级好!尽管它不被Internet Explorer或Safari支持)。


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

    解决方案

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

    <input name="your_name" value="your_value" type="checkbox">
    

    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).)

    这篇关于正确的方式来做HTML5复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆