title: Jquery stop submit and get data from form
body: <p>I'm trying to use jquery to get data from a form and stop the form submiting using this code:</p>
  
  <pre><code>$form = $('form#signup')
  $form.submit(function(event){
    event.preventDefault();
    var $input=$('#signup :input')
    console.log($input.username)
    alert($input.username)
  })
  </code></pre>
  
  <p>but the form still <code>post</code>s the data and the alert box does not appear.Also firebug brings up the error <code>$ is not defined</code> and Node.js crashes</p>
  
  <p>the form (writen in jade):</p>
  
  <pre><code>html
    head
      script(src='javascripts/signupValidation.js')
      script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
      script(src='javascripts/validator.js')
    body
      form(id='signup',method='post',action='/signup')
        label Firstname
        input(type='text', name='firstname')
        label Lastname
        input(type='text', name='lastname')
        label Username
        input(type='text', name='username')
        label Password
        input(type='password', name='password')
        label Password again
        input(type='password', name='password2')
        label Email
        input(type='email', name='email')
  
    input(type='submit',value='Sign up', onclick="")
  </code></pre>