输入文本元素的正确只读属性语法是什么? [英] What is the correct readonly attribute syntax for input text elements?
本文介绍了输入文本元素的正确只读属性语法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
和大多数人一样,我熟悉 text input
的 readonly
属性,但是在阅读其他网站的代码时(我的一个坏习惯),我看到了不止一个此属性的实现:
As Most, I am familiar with the readonly
attribute for text input
, But while reading code from other websites (a nasty habit of mine ) I saw more than one implementation for this attribute:
<input type="text" value="myvalue" class="class anotherclass" readonly >
和
<input type="text" value="myvalue" class="class anotherclass" readonly="readonly" >
我什至见过
<input type="text" value="myvalue" class="class anotherclass" readonly="true" >
.. 我相信我看到了更多,但现在想不起来确切的语法了..
.. And I believe I saw even more, but can not recall the exact syntax now..
那么,我应该使用哪一个是正确的?
So, which one is the correct one that I should use?
推荐答案
来自 w3:
readonly = "readonly" 或 ""(空字符串) 或 empty -指定该元素表示其值不可编辑的控件.
readonly = "readonly" or "" (empty string) or empty - Specifies that element represents a control whose value is not meant to be edited.
所以基本上是一样的.
这篇关于输入文本元素的正确只读属性语法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文