javascript 占位符在 IE9 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12600128/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
placeholder not working in IE9
提问by Bibu
Possible Duplicate:
placeholder in ie9
可能的重复:
ie9 中的占位符
I'm using placeholder for my textboxes. The problem is that in firefox and chrome they show up but in IE9 it's not working. I searched on the internet but none of the solutions worked for me. Any ideas?
我正在为我的文本框使用占位符。问题是在 Firefox 和 chrome 中它们显示出来,但在 IE9 中它不起作用。我在互联网上搜索,但没有一个解决方案适合我。有任何想法吗?
<input class="text" type="text" name="name" value="" placeholder="Name" required /><br />
回答by Raymond Camden
If you mean the placeholder attribute, it is not supported in IE9: http://caniuse.com/#search=placeholder. You will need to use another solution to mimic the behavior.
如果您的意思是占位符属性,则 IE9 不支持它:http: //caniuse.com/#search=placeholder。您将需要使用另一种解决方案来模仿该行为。
回答by xdazz
IE9 doesn't support HTML5's placeholder.
IE9 不支持 HTML5 的占位符。
You need to do it with javascript.
你需要用javascript来做。
Check this plugin.
检查这个插件。