Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Placeholder browser compatibility

What browsers support the placeholder html tag for text inputs? Does Internet Explorer support it? (I have a JavaScript placeholder that I can use for the browsers that do not support it.)

<input type=TEXT placeholder="placeholder here" />

like image 1000
NoodleOfDeath Avatar asked Oct 23 '10 13:10

NoodleOfDeath


People also ask

Why my placeholder is not working in HTML?

If you have an input in your form and placeholder is not showing because a white space at the beginning, this may be caused for you "value" attribute. In case you are using variables to fill the value of an input check that there are no white spaces between the commas and the variables.

Can I use :: placeholder?

Only the subset of CSS properties that apply to the ::first-line pseudo-element can be used in a rule using ::placeholder in its selector. Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default.

Which browsers supports HTML?

HTML5 is now compatible with all popular browsers (Chrome, Firefox, Safari, IE9, and Opera) and with the introduction of DOCTYPE, it is even possible to have a few HTML features in older versions of Internet Explorer too.

Does HTML5 use placeholder attribute?

HTML5 includes a placeholder attribute that allows you to declaratively specify this temporary text. This is typically a short length text. It's a quick and easy solution for functionality that's very widely used.


2 Answers

It is currently supported by all major browsers except IE 9 and earlier and Opera mini.

For updates, look at the w3schools-specs Or even better, view this overview.

like image 91
Tim Avatar answered Oct 06 '22 23:10

Tim


For anyone interested, this is the jQuery Fallback that I use
I use it with jQuery Validation Engine.
Replace FORMCLASS with the class of your form.

<!-- IF IE - use Placeholder Fallback --> <!--[if lt IE 10 ]> <script>   $(".FORMCLASS").find('[placeholder]').each(function(){      $(this).val($(this).attr('placeholder'));     $(this).focus(function() {       if ($(this).attr('placeholder')==$(this).val()) {         $(this).val('');       }     });   }); </script> <![endif]-->  
like image 38
Jera Avatar answered Oct 06 '22 23:10

Jera