WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How do I clear input form textbox when starting to type?

[Resolved] How do I clear input form textbox when starting to type?

  • I have put a form in the heading of my blog, but due to space constraint I’ve put the label for each field inside the forms text entry fields. I’d like this text to clear when the user clicks or starts typing inside the entry fields in the form. How do I do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I use this for my search form. It puts the word Search in the text box and as soon as you click on it, it clears.

    HTH

    <form name=form1 method="get" action="http://landroveroneten.com/wordpress">
    <input type="text" name="s" id="s" size="24" class="searchform-textbox" value="Search" onclick="document.form1.s.value ='';">
    			</form>

    Thanks, that worked, allthough I just inserted onclick=”value=”” at the end of the line containing the initial value for the contents of the entry box.
    Still works, thanks. 🙂

    Thanks xrun and madcowz – the onclick=”value=”” code worked for me to, and its pretty slick compared to before.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] How do I clear input form textbox when starting to type?’ is closed to new replies.
Skip to toolbar