On Jul 12, 7:53 am, windandwaves <nfranc...@gmail.comwrote:
Hi Folk
For input boxes in forms, some forms have default values e.g. "enter
phone number here". When a user wants to enter their details, they
first have to remove the default entry - which can be a bit annoying
at times. I have written a very simple little script (obviously not
the first one) that removes the default entry. You can find it here:
http://www.sunnysideup.co.nz/j/form/
Some suggestions...
You should only apply the function to text inputs, not all input
elements.
When the control is blurred and nothing is entered, you return it to
the default value. However, when the control next receives focus, the
function doesn't fire. Onfocus you might like to test something like:
if (input.value == input.defaultValue) input.value = '';
You might be better off to apply the handler based on the control's
class, that way you can apply it to textarea elements too.
--
Rob