Home >Web Front-end >JS Tutorial >Methods to control the display and hiding of prompt information in the input box_javascript skills
When using html css javascrpt to create pages, we often encounter some small details that affect the user experience and are easily overlooked by us. For example, how can the prompt information in the input box be displayed and hidden according to the object gaining and losing focus. I am here today and want to share this little trick with you. I hope that all the masters will not make mistakes~~~
1. Requirements
Input input box, hide the prompt information when the cursor is displayed ; When the cursor leaves the input box, a prompt message is displayed.
2. Method
1. Give the input an id name, Onfocus="Method Name 1 (this)", onblur="Method Name 2 (this)"
2. Declare the variable value and obtain the input through the id name
3. Function method name 1 (inputObj){