Html – jQuery form reset button for all entered values

htmljquery

I am using a form and a reset button where I can reset all the entered values but it is not working at all.

When I debugged with the Firefox console tab, I saw an error illegal character at the end of the jQuery script. Can someone tell me what is the wrong part here?

<!DOCTYPE HTML>
<html lang="en-IN">
<head>
  <meta charset="UTF-8">
  <title></title>
  <script type="text/javascript" src="js/jquery1.7.2.js"></script>
</head>
<body>
  <script type="text/javascript">
    jQuery('#reset').click(function(){
        $(':input','#myform')
        .not(':button, :submit, :reset, :hidden')
        .val('')
        .removeAttr('checked')
        .removeAttr('selected');
    });​
</script>
<form id='myform'>
  <input type='text' value='test' />
    <select>
      <option>One</option>
      <option selected="true">Two</option>
    </select>
    <select multiple="true" size="5">
      <option>One</option>
      <option selected="true">Two</option>
    </select>
    <input type='button' id='reset' value='reset' />
</form>​
</body>
</html>

Best Answer

Won't the <input type="reset" > suffice?

<form>

   <input type='reset'  />

</form>

DEMO