【问题标题】:How can I change an input placeholder text using CSS如何使用 CSS 更改输入占位符文本
【发布时间】:2020-05-12 23:07:45
【问题描述】:

我正在使用 wordpress,我正在尝试使用 CSS 更改输入占位符内容的内容。通过这样做,我能够在桌面版本中做到这一点。

.st-location-new:before {
    content: 'Routes';
    visibility:visible;
}
<label class="st-location-new">Where are you going</label>

在移动版本中,我无法通过应用相同的方法更改占位符文本,但没有任何成功。我能够更改字体的颜色和大小,但不能更改内容。

<input type="text" name="location_name" class="form-control" readonly="" placeholder="Where are you going?" id="dropdown-mobile-destination" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" value="">

【问题讨论】:

  • Chrome 不再支持它。您需要改用 HTML 或 JS。

标签: html css wordpress


【解决方案1】:

试试这个 JavaScript 代码并删除标签语句

document.getElementsByName('location_name')[0].placeholder='Routes';

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    • 2011-02-06
    • 2020-02-23
    • 2018-11-17
    相关资源
    最近更新 更多