We all know that when the mailbox landing when the default state will have a text reminder, when the mouse focus on the mailbox text box, the content text will be emptied.
HTML5 has a placeholder (placeholder) attribute, but compatibility is not particularly good ~ Here's how jquery works
CSS code:
<input type= "text" id= "address" value= "Please enter your email address"/>
<input type= "text" id= "password" value= "Please enter password"/>
<input type= "button" value= "Login"/>
jquery Code:
$ (function () {
$ ("#address"). focus (function () {//Address box gets mouse focus
var txt_value=$ (this). Val (); Get the value of the current text box
if (txt_value==this.defaultvalue) {//Use DefaultValue property
$ (this). Val (""); Empty the contents of the text box if the condition is met
};
});
$ ("#address"). blur (function () {//Address box loses mouse focus
var txt_value=$ (this). Val (); Get the value of the current text box
if (txt_value== "") {
$ (this). Val (This.defaultvalue); If the condition is met, the content is set
};
});
});
Mailbox Login Interface Placeholder (placeholder) jquery method