Everyone is aware of HTML5 in Ie10 above the version only support, recently with the bootstrap front-end development framework to make a website, want to IE10 below can also hint, so you have to use JS camouflage under.
First determine if the browser supports placeholder
if (! (' Placeholder ' in document.createelement (' input '))
Then append text, which would have wanted to change the Val value directly, to get the mouse to clear, but if you need to verify that he is required to fill in the wrong. So the text is still appended.
$ ("input"). Not ("input[type= ' password ')". each (//Exclude Input binding event Password box
function () {
if ($ (this). val () = = "" && $ (this). attr ("placeholder")! = undefined) {
$ (this). After (' <input class= ' + $ (this). attr ("class") + ' "type=" text "Value= ' + $ (this). attr (" placeholder ") + ' Autoc omplete= "Off"/> ');
$ (this). Val ($ (this). attr ("placeholder"));
$ (this). Hide (); $ (this). Next (). Show ();
$ (this). Next (). focus (function () {
$ (this). Prev (). Show ();
$ (this). Prev (). focus ();
$ (this). Hide ();
});
$ (this). blur (function () {
if ($ (this). val () = = "") {$ (this). Hide (); $ (this). Next (). Show (); }
});
}
Perhaps not quite perfect, I hope you will point out.
HTML5 placeholder in ie10 below pseudo hint