- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to clear an input field on focus with CSS?
Following is the code to clear an input field on focus −
<!DOCTYPE html> <html> <head> <h1>Clearing an input field on focus example</h1> <input type="text" onfocus="this.value=''" value="Some random text..."> <h2>Click on the above field to clear its value</h2> </body> </html>
The above code will produce the following output −
On clicking the field, the inner value will be cleared −
- How to set focus on a text input in a list with AngularJS and HTML5
- How to include an input field in HTML?
- How to use input type field with date field in HTML?
- How to disable autocomplete of an HTML input field?
- Large input field with Bootstrap
- Small input field with Bootstrap
- How to clear an entire Treeview with Tkinter?
- How to display an element on hover with CSS?
- How to create a navigation menu with an input field inside of it?
- How to clear floats with the "clearfix" hack with CSS?
- How to change an HTML5 input's placeholder color with CSS?
- How to zoom/scale an element on hover with CSS?
- How do you focus on new windows with selenium ide?
- How to use input type field with steps in HTML?