JavaScript onclick clear textbox; if nothing entered re-display default text

  • Status Closed
  • Budget N/A
  • Total Bids 31

Project Description

There is a textbox with the text "Keywords" in it.

If the user clicks in the textbox, the contents of it should clear.

Currently I have the above working using JavaScript's onclick event.

This is what I need:

If the user then moves focus away from the textbox without having entered something, the text "Keywords" should re-display in the textbox.

Example:

Textbox has "Keywords" written in it.

User click in the textbox and the textbox becomes blank.

The user clicks somewhere else on the screen. The textbox should get re-populated with the text "Keywords".

Get free quotes for a project like this
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online