Hide Form Input Text onClick

Here’s a simple little tutorial on how to hide form input text “onClick” using Javascript.

Notice you’ll need to include these elements within the input field: onclick, onblur, and value.

<input type="text" name="name" onclick="if(this.value=='Enter your name'){this.value=''}" onblur="if(this.value==''){this.value='Enter your name'}" value="Enter your name" />

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.