-3

我正在使用以下代码

<input required type="text" name="name" placeholder="Enter your name.." />

但是IE浏览器中没有出现占位符值,请给我一个解决方案或给我一个替代方法。

4

2 回答 2

1

IE9 and earlier don't support the placeholder attribute. It's in IE10+.

There are a number of JavaScript solutions out there, if you look for "placeholder shim" or similar. For instance, I did the place5 jQuery plug-in, but that won't help you if you don't use jQuery. But again, there are several others out there. This question and its answers list several.

于 2013-11-01T08:04:45.680 回答
0

您也可以在 IE 浏览器中显示占位符。使用这个插件,这可能是最简单的方法了。

适用于所有 A 级浏览器,包括 IE6。

祝你好运!

于 2013-11-01T08:09:30.860 回答