1

None of the solution above(Clear form fields with jQuery) works on a simple case when the page includes a call to web user control that involves IHttpHandler request processing (for captcha regenaration). After sending the requsrt (for image processing) the code below does not clear the fields on the form (text ntered before sending the HttpHandler request ). If the IHttpHandler request was not isuued by the user, then everythings works correctly and the form is cleared.

<input type="reset"  value="ClearAllFields" onclick="ClearContact()" />

 <script type="text/javascript">
   function ClearContact() {
       ("form :text").val("");
   }
</script>
Community
  • 1
  • 1

1 Answers1

0

You missed $ for jQuery before selector.

Change

("form :text").val("");

To

$("form :text").val("");

Your code would be

<script type="text/javascript">
   function ClearContact() {
       $("form :text").val("");
   }
</script>
Adil
  • 146,340
  • 25
  • 209
  • 204