Placeholder font style and compatibility, placeholder Font Style
Style modification css
:-Webkit-input-placeholder {/* WebKit browsers */color: # fff! Important ;}
:-Moz-placeholder {/* Mozilla Firefox 4 to 18 */color: # fff! Important ;}
:-Moz-placeholder {/* Mozilla Firefox 19 + */color: # fff! Important ;}
:-Ms-input-placeholder {/* Internet Explorer 10 + */color: # fff! Important ;}
Compatibility Method
// Determine whether the browser supports placeholder
Var isPlaceholderSupport = (function (){
Return 'placeholder' in document. createElement ('input ');
})();
If (! IsPlaceholderSupport ){
$ ('[Placeholder]'). focus (function (){
Var input = $ (this );
If (input. val () = input. attr ('placeholder ')){
Input. val ('');
Input. removeClass ('holder ');
}
}). Blur (function (){
Var input = $ (this );
If (input. val () = ''| input. val () = input. attr ('placeholder ')){
Input. addClass ('holder ');
Input. val (input. attr ('holder '));
}
}). Blur (). parents ('form'). submit (function (){
$ (This). find ('[placeholder]'). each (function (){
Var input = $ (this );
If (input. val () = input. attr ('placeholder ')){
Input. val ('');
}
})
});
}