可能重复:
ie9 中的占位符
http://jsfiddle.net/zhshqzyc/mGAPs/中的一个非常简单的测试
我的代码:
<div id="generatePinsDialog" >
<label for="newCount" style="width: 400px;">
How many?</label>
<input id="newCount" type="text" size="25" placeholder="Enter the number!" />
<br />
和:
jQuery(function() {
jQuery.support.placeholder = false;
test = document.ElementById("newCount");
if('placeholder' in test) jQuery.support.placeholder = true;
});
它适用于谷歌浏览器,但适用于 IE 9。
感谢您更正代码。