Skip to:
Content
Pages
Categories
Search
Top
Bottom

onfocus Remove default value from Text Input

  • @nickbwatson

    Participant

    I’m trying to add a default value to an input textbox that I have, but I want that value to disappear when the user clicks it.

    So I wanted to use a code like this:

    onfocus="if (this.value == 'Start writing a short message...') {this.value = '';}"

    HOWEVER, the problem is that my code is within an echo command,

    something like this:

    echo '<input type="text" name="blah" size="40" id="blah" value="Default" >'

    so as soon as the next ” ‘ ” apostrophe comes up in the onfocus, it closes the echo command.

    Is there something else I can do?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘onfocus Remove default value from Text Input’ is closed to new replies.
Skip to toolbar