0

Possible Duplicate:
placeholder in ie9

A very simple test in http://jsfiddle.net/zhshqzyc/mGAPs/

My code:

<div id="generatePinsDialog" >
<label for="newCount" style="width: 400px;">
    How many?</label>
<input id="newCount" type="text" size="25" placeholder="Enter the number!" />
<br />

And:

jQuery(function() {
     jQuery.support.placeholder = false;
     test = document.ElementById("newCount");
     if('placeholder' in test) jQuery.support.placeholder = true;
});

It works in google chrome but IE 9.

Thanks for correcting the code.

Community
  • 1
  • 1

2 Answers2

1

The placeholder attribute does not work in IE, only modern browsers. IE10 now does, though, finally.

Most of the time things like this will work in modern browsers but you need to always double check to see if it works in IE which is usually years behind all the others. One place would be http://caniuse.com/

Rob
  • 14,746
  • 28
  • 47
  • 65
0

Assuming that you just want to check, whether the placeholder is supported by a browser, you can use this code:

jQuery(function() {
     jQuery.support.placeholder = ( 'placeholder' in (document.createElement( 'input' )) );
});

Aside from this, as mentioned in the comments, IE9 does not support placeholder (see caniuse.com)!

Sirko
  • 72,589
  • 19
  • 149
  • 183