Link to home
Start Free TrialLog in
Avatar of webdork
webdork

asked on

javascript clear single text field

I want to clear a single form field (text) with a hyperlink.
Something like this:
<a href="javascript:form1.datefield.value=' ' " >clear date</a>
Avatar of HonorGod
HonorGod
Flag of United States of America image

What's the problem.  That looks like it should work,
as long as:

The form has a "name" attribute of "form1", e.g.,

<form name="form1" ...>

and the input field has a "name" attribute of "datefield"

e.g.,

<input type="text" name="datefield">
Avatar of webdork
webdork

ASKER

Its a syntax error. must be with the quote double quote

Ive tried
<a href='javascript:form1.USWP_Expiry.value=""' >clear date</a>

and
<a href="javascript:form1.USWP_Expiry.value= ' ' " >clear date</a>
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of webdork

ASKER

That did it.

Thank you.

WD