title: jquery.min.js:2 Uncaught TypeError: event.preventDefault is not a function
body: <p>I have a function that countdown time when start button is clicked  when time reach 0 form should do auto-submit but the the form submit twice when I use preventDefault() output error event.preventDefault is not a function  </p>
  
  <p>Here is my code</p>
  
  <pre><code>    &lt;script&gt;
      $(document).ready(function () {
          $('#startbutton').click(function (e) {
              e.preventDefault()
              var t = $(this).attr('timevalue');
              var fiveMinutes = 60 * parseInt(t);
              $(function ($) {
                  $('#festus').hide();
                  display = $('#time');
                  startTimer(fiveMinutes, display);
              });
          });                
  
          function startTimer(duration, display) {
              var timer = duration, minutes, seconds;
              var __timer = setInterval(function () {
              minutes = parseInt(timer / 60, 10);
              seconds = parseInt(timer % 60, 10);
  
              minutes = minutes &lt; 10 ? "0" + minutes : minutes;
              seconds = seconds &lt; 10 ? "0" + seconds : seconds;
  
              display.text(minutes + ":" + seconds);
  
               if (--timer &lt; 0) {
                   clearInterval(__timer);
                   var form_id = $('#questionsandanswers').serializeArray();
                          var url = $('#questionsandanswers').attr('action');
  
  
                 $(function (event) {
                     event.preventDefault();
                      $.post(url, form_id, function (data) {
                          alert('time is up you can no longer proceed');
                      });
                  });
              }                      
           },1000);
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>what can I do to avoid form to submit twice</p>