我知道,Internet Explorer不支持输入变量的占位符属性,但肯定在2012年必须有IE另一种解决方案?
Answer 1:
我写了一个jQuery插件了一段时间后,将增加占位符支持,不支持任何浏览器。
在IE浏览器的占位符文本
Answer 2:
事实上,IE 不支持在2012占位符属性(第10版)。 还有一点, 一个填充工具对旧的浏览器,你应该有一个全面的解决您的问题。
Answer 3:
我们一直在使用现在这个jQuery插件在生产了几个星期,它似乎是伟大的工作。
http://webcloud.se/code/jQuery-Placeholder/
Answer 4:
http://the.deerchao.net/PlaceHolder它适用于即没有任何通话功能...
Answer 5:
尝试通过我开发了这个jQuery插件
https://github.com/ramsunvtech/jQuery-Plugins/tree/master/IEPlaceHolder
Answer 6:
是的,有针对IE8和IE9一个非常简单的解决方案,因为对IE的版本刨丝它已经工作。 (IE10,IE11等等)
这是解决方案,我发现:
1.检测Internet Explorer版本
<!--[if lt IE 10]>
<script type="text/javascript">var ie = 9;</script>
<![endif]-->
<!--[if lt IE 9]>
<script type="text/javascript">var ie = 8;</script>
<![endif]-->
2.修正占位符
if (typeof ie == 'undefined') var ie = 10;
if (ie == 8 || ie == 9){
$("input[placeholder]").each(function() {
this.value = $(this).attr('placeholder');
});
$("input[placeholder]").focus(function()
if (this.value == $(this).attr('placeholder')) this.value = '';
}).blur(function() {
if (this.value == '')
this.value = $(this).attr('placeholder');
});
}
文章来源: Placeholder attribute on input tags for IE?