How to prevent form submit for href within a form?
Hi,
I have this form:
- <form id="FormSignin" name="FormSignin" class="login" autocomplete="off">
- <h1 class="login-title">مركز الإمام الصادق عليه السلام</h1>
- <input id="email" name="email" type="email" class="login-input" placeholder="البريد الإلكتروني" autofocus autocomplete="off" required="true">
- <input id="password" name="password" type="password" class="login-input" placeholder="كلمة السر" autocomplete="off" required="true">
- <img id="ImageSigninLoading" src="images/loading.gif" style="width: 50px; height: 50px; display: none;" />
- <input id="btnSignin" name="btnSignin" type="submit" value="دخول" class="login-button" onclick="btnSignin_Click()">
- <p class="login-lost"><a id="LinkForgotPassword" name="LinkForgotPassword">نسيت كلمة السر؟</a></p>
- <p class="login-lost"><a id="LinkNewUser" name="LinkNewUser">مستخدم جديد</a></p>
- </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.
- $('#LinkNewUser').click(function(e)
- {
- e.preventDefault();
- window.location.href = "new_parent.php";
- });
here is the page;
Thanks,
Jassim