matthewkerry.com
Clear a textfield when a user clicks on it
A textbox is displayed with some default text - in this example "Enter keyword here...". When the user clicks on the text field the default text disappears. Easy enough. The trick is to only clear the textbox when the default text is displayed - so the user doesn't lose their input. This is done by comparing the value in the textbox and the value in a hidden field.