javascript - 键入时保留输入的占位符文本
问题描述
我有这个输入:
<input type="number" class="textfield numberField font" name="Price" placeholder="Price"><br>
所以文字place holder
是价格。当用户开始输入时,我想保留这个词price
。
因此,如果他键入65,他将在输入中看到:
Price 65
我需要在里面为这个词创建另一个 div price
,还是可以使用 js 或 html 来完成?
解决方案
我想你想成为那样的人。
.full-input {
display: inline-block;
padding: 3px;
border: 2px solid blue;
}
input {
outline: none;
border: none;
display: inline-block;
line-height: 1.2em;
font-size: 14pt;
}
label {
display: inline-block;
font-size: 12px;
color: blue;
}
<div class='full-input'><label for='price'>Price</label>
<input type='number'class="textfield numberField font" name="Price">
</div>
推荐阅读
- c# - 请求被中止:无法创建 SSL/TLS 安全通道。调用 PostAsJsonAsync 时
- excel - 查找一个值,在另一个工作簿中查找匹配值的最后一列
- cron - 每次运行时创建文件的 Cron 作业
- html - 是否可以自定义文本框的形状?
- json - 使用 Pyspark 将包含在单个文件中的 JSON 对象合并到一个 JSON 文件中
- python-3.x - Python 3.6:NameError:名称“A”未定义
- c - 从C中的字符串中删除出现的数组
- aws-kms - 微软的 KMS 在功能上是否与亚马逊的 KMS 相同?
- mysql - MySQL - 多行触发器
- pycharm - 使用 attrs 对子类进行 Pycharm 类型提示