WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do I clear input form textbox when starting to type? (4 posts)

  1. xrun
    Member
    Posted 5 years ago #

    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?

  2. madcowz
    Member
    Posted 5 years ago #

    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>
  3. xrun
    Member
    Posted 5 years ago #

    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. :)

  4. lyzdog
    Member
    Posted 5 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic