disabled 属性的正确值是多少? [英] What is the correct value for the disabled attribute?

查看:26
本文介绍了disabled 属性的正确值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文本框或文本区域的 disabled 属性的正确值是多少?

What is the correct value for the disabled attribute for a textbox or textarea?

我以前见过以下用法:

<input type="text" disabled />
<input type="text" disabled="disabled" />
<input type="text" disabled="true" />

推荐答案

  • 对于 XHTML,<input type="text" disabled="disabled"/> 是有效的标记.
  • 对于 HTML5,<input type="text" disabled/> 是有效的,并被 W3C 用于他们的示例.
  • 事实上,这两种方式都适用于所有主流浏览器.
    • For XHTML, <input type="text" disabled="disabled" /> is the valid markup.
    • For HTML5, <input type="text" disabled /> is valid and used by W3C on their samples.
    • In fact, both ways works on all major browsers.
    • 这篇关于disabled 属性的正确值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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