Take a simple example, the mouse click on the input box, prompt text message, the mouse to move away, and then display the prompt text.
<script type= "Text/javascript" >//Writing plugins(function($) {$.fn.placeholder=function(option) {varinput = This; Input.focus (function () { if(Input.val () = = "" | | Input.val () = =option. DefaultValue) {Input.val (""); if(option. Writingcolor = = undefined) option. Writingcolor = "#000000"; Input.css ("Color", option. Writingcolor); } }); Input.blur (function () { if(Input.val () = = "") {input.val (option. DefaultValue); if(option. DefaultColor = = undefined) option. DefaultColor = "#000000"; Input.css ("Color", option. DefaultColor); } }); if(Input.val () = = "") Input.blur (); }}) (JQuery); //called$ ("#username"). Placeholder ({defaultvalue: "Please enter user name", DefaultColor: "#888", Writingcolor: "#000000" }); </script>