Placeholder is another attribute added to HTML5. When the input or textarea has set this attribute, the content of this value will be displayed in the text box as a gray-word prompt. When the text box gains focus, the prompt text disappears. HTML5 has made many enhancements to Web Form, such as the type type added to input, Form Validation, etc.
Placeholder is another attribute added to HTML5. When input or textarea sets this attribute, the content of this value will be displayed in the text box as a gray-word prompt. When the text box gains focus, the prompt text disappears. In the past, I used JavaScript to control this effect to achieve it. Firefox, Google Chrome, etc. expressed support for it, but IE felt inconsistency!
For example: <input id=t1 type=text placeholder=Please enter text/
This introduces a super powerful attribute plug-in that supports placeholder under IE, and is also compatible with other browsers that do not support placeholder. The code is as follows:
Copy the code