Posts

Showing posts from March, 2013

Support the HTML5 placeholder Attribute in Browsers that do not support it

Image
HTML5 language gives us the possibility of a Placeholder. The placeholder Attribute gives us information on the textbox where we are supposed to use. All you need is to add the same type of input tag. <input type="text" name="first_name" placeholder="First name"> Browsers that do not support it will show like: Browsers that support it will show like: If you want the older browsers will support it, all you have to do is add the following JQuery code: /* Input Tag Placeholder Support*/ function IsInputPlaceholderSupport() {     var i = document.createElement( 'input' );     return 'placeholder' in i; } $(document).ready( function () {     if (!IsInputPlaceholderSupport()) {         var fields = $( 'input' );         for ( var i = 0; i < fields.length; i++) {        ...