my .val() is not working
here is my code
function validate() {
  var username = $('#username').val();
  console.log(username);
  var userEmail = $('#email').val();
  var password = $('#password').val();
  var cpassword = $('#cpassword').val();
}<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form action="index.php" method="post" name="signupForm" id="signupForm">
  <div class="form-group">
    <label for="forUserName">User Name:</label>
    <input type="text" name="username" id="username" class="form-control" placeholder="Enter User Name" aria-describedby="helpId">
  </div>
  <div class="form-group">
    <label for="forEmail">Email:</label>
    <input type="email" name="signupemail" id='signupemail' class="form-control" placeholder="Enter Your Email" aria-describedby="helpId">
  </div>
  <div class="form-group">
    <label for="">password:</label>
    <input type="password" name="password" id="password" class="form-control" placeholder="Enter Password" aria-describedby="helpId">
  </div>
  <div class="form-group">
    <label for="forConfirmPassword">Confirm Password</label>
    <input type="password" name="cpassword" id="cpassword" class="form-control" placeholder="Enter Confirm Password" aria-describedby="helpId">
  </div>
  <button class="btn btn-primary" onclick="validate();">signup</button>
</form> 
    