HTML输入-已填写文本 [英] HTML Input - already filled in text
问题描述
我想知道,有没有一种方法可以将文本输入到输入字段中? 我现在得到的是一个占位符,但这实际上是一个空的输入字段.所以那不是我想要的. 我正在寻找一种(某种)占位符,该占位符实际上已填写到输入字段中,而不是背景文本"
I was wondering, is there a way to put text into an input field? What i've got now is a placeholder, but that's actually an empty inputfield. So that's not what i'm looking for. I'm looking for an (kind of) placeholder that's actually filled in into the input field, so not "background text"
这是与占位符一起使用的:
This is with placeholder:
这就是我想要的:
有什么办法吗?
提前谢谢!
推荐答案
值内容属性提供输入元素的默认值.
The value content attribute gives the default value of the input element.
- http://www.w3. org/TR/html5/forms.html#attr-input-value
要设置输入元素的默认值,请使用value
属性.
To set the default value of an input element, use the value
attribute.
<input type="text" value="default value">
这篇关于HTML输入-已填写文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!