Internet Explorer缺少占位符支持,特别是密码字段

Internet Explorer lack of placeholder support, specifically password fields

本文关键字:特别是 密码 字段 支持 占位符 Explorer Internet      更新时间:2023-09-26

好的,为了克服IE不支持HTML5的占位符属性的问题,我写了一些JS,它在输入上循环,并将输入的值设置为不支持它的浏览器的占位符属性值。现在这很好,但在密码字段上,无论值是什么,都会显示为点/项目符号来模糊密码。

现在我可以采取什么措施和方法来解决这个问题?

要在输入时具有占位符样式效果[键入="password"]?

在查看HTML5 Cross Browser Polyfills的"Web Forms:input placeholder"部分时,我看到了一个jQuery-HTML5-占位符。

我用IE9试用了这个演示,它看起来像是用一个跨度包裹了<input>,并用占位符文本覆盖了一个标签。

<label>Text:
  <span style="position: relative;">
    <input id="placeholder1314588474481" name="text" maxLength="6" type="text" placeholder="Hi Mom">
    <label style="font: 0.75em/normal sans-serif; left: 5px; top: 3px; width: 147px; height: 15px; color: rgb(186, 186, 186); position: absolute; overflow-x: hidden; font-size-adjust: none; font-stretch: normal;" for="placeholder1314588474481">Hi Mom</label>
  </span>
</label>

那里还有其他垫片,但我没有全部看一遍。

从Internet Explorer 的输入占位符引用