Questions like title:
When the mouse clicks into the input box, the prompt in the input box disappears, the mouse moves away, and the prompt in the input box appears. As shown in the figure:
The following methods are as follows:
The code copy is as follows:
<input type="text" name="name" id="name" onfocus="if (value =='Please enter 2-5 Chinese names'){value =''}" onblur="if (value ==''){value='Please enter 2-5 Chinese names'}" value="Please enter 2-5 Chinese names">
<input type="text" name="tel" id="tel" value="Please enter your phone number" onfocus="if (value =='Please enter your phone number'){value =''}" onblur="if (value ==''){value='Please enter your phone number'}">
Note that the onblur and onfocus properties of input are the onblur and onfocus properties. There are also simple if judgments. Very convenient and practical.
The above is all the content described in this article, I hope you like it.