How to prevent form submit for href within a form?

How to prevent form submit for href within a form?

Hi,

I have this form:

  1. <form id="FormSignin" name="FormSignin" class="login" autocomplete="off">
  2.     <h1 class="login-title">مركز الإمام الصادق عليه السلام</h1>
  3.     <input id="email" name="email" type="email" class="login-input" placeholder="البريد الإلكتروني" autofocus autocomplete="off" required="true">
  4.     <input id="password" name="password" type="password" class="login-input" placeholder="كلمة السر" autocomplete="off" required="true">
  5.     <img id="ImageSigninLoading" src="images/loading.gif" style="width: 50px; height: 50px; display: none;" />
  6.     <input id="btnSignin" name="btnSignin" type="submit" value="دخول" class="login-button" onclick="btnSignin_Click()">
  7.     <p class="login-lost"><a id="LinkForgotPassword" name="LinkForgotPassword">نسيت كلمة السر؟</a></p>
  8.     <p class="login-lost"><a id="LinkNewUser" name="LinkNewUser">مستخدم جديد</a></p>        
  9. </form>


and for the LinkNewUser I need to redirect to a new-parent_page.php

When I click the first time on the href it will first validate the form and tell me to enter the email address but when  I click the second time it will redirect to the page.

I tried to preventDefault but still not working.

  1. $('#LinkNewUser').click(function(e)
  2. {
  3.     e.preventDefault();
  4.     window.location.href = "new_parent.php";
  5. });


here is the page;



Thanks,
Jassim