Placeholder is a new property of HTML5, and when input or textarea is set, the content of the value is displayed as a gray hint in the text box, and the text box disappears when it gets the focus (or input).
However, in browsers that do not support HTML5, the placeholder property is not valid, for example, IE9 and the following are incompatible with this property. The following describes the processing of placeholder compatibility
Add the following script to the page
$ (function () { // If placeholder is not supported, use jquery to complete if (!issupportplaceholder ()) { // iterates through all input objects, except for the Password box $ (' input '). Not ("input[ Type= ' password '). each ( function () { var self = $ (This); var Val = self.attr ("placeholder"); input (Self, val) ; } ); /**//* Special handling * 1 for password boxes. Create a text box * 2. Switch */ $ (' input[type= ' when getting focus and losing focus Password "]). each ( function () { var pwdfield = $ (this); var pwdval = pwdfield.attr (' placeholder '); &NBSP;&NBSP;&NBSP;&NBSP;VAR&NBSP;PWDID&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;=&NBSP;PWDFIELD.ATTR (' id '); // Rename the input ID as the original ID followed by 1 pwdfield.after (' <input id= ' + pwdid + ' 1 " type=" text " value= ' +pwdval+ ' autocomplete=" Off " />"); var pwdplaceholder = $ (' # ' + pwdId + ' 1 '); pwdplaceholder.show (); pwdfield.hide (); pwdplaceholder.focus (function () { pwdplaceholder.hide (); Pwdfield.show (); pwdfield.focus (); }); pwdfield.blur (function () { if (Pwdfield.val () == ") { pwdplaceholder.show (); pwdfield.hide (); } }); } ) });// determine if the browser supports placeholder attribute function issupportplaceholder () { var input = document.createelement (' input '); return ' placeholder ' in input;} jquery Replacement placeholder processing function input (obj, val) { var $input = obj; var val = val; $input. attr ({value:val}); $ Input.focus (function () { if ($input. Val () == val) { $ (This). attr ({value: "}"); } }). blur (Function () { if ($input. Val () == "") { $ (This). attr ({value:val}); } });
Reference: Placeholder Compatibility http://www.studyofnet.com/news/1022.html
Compatibility of placeholder Properties