0

I have two forms on a page. when I click on the forgot password link the second form loads. Now if I click submit, it will relaod the page and go back to the first form being displayed. I want to be able to click submit and allow the page to load the second form displaying.

my jquery

$(document).ready(function() {

     $("#pass").click(function() {
         $("#signin").css('display', 'none');
         $("#passreset").css('display', 'block');

     });

     $("#pass1").click(function() {
         $("#passreset").css('display', 'none');
         $("#signin").css('display', 'block');

     });


     if ($('#pass1').is(":visible")) {
         $("#submit").click(function() {
             $(document).load(function() {
                 $("#signin").css('display', 'none');
                 $("#passreset").css('display', 'block');
             });

         });
     }

am I way off? Does anyone know an easier way to do this?

Afsar
  • 3,104
  • 2
  • 25
  • 35
  • Try [these](http://stackoverflow.com/questions/1263852/prevent-form-redirect-or-refresh-on-submit) [answers](http://stackoverflow.com/questions/19454310/stop-form-refreshing-page-on-submit)? – Sze-Hung Daniel Tsui May 25 '15 at 09:40
  • 1
    Prevent form from submitting (return false), use ajax to communicate with server . Also don't nest event bindings (document.load happens before #submit.click. – Justinas May 25 '15 at 09:40
  • I am adding key value pairs to the URL when an invalid email is entered, will returning false prevent these from showing? –  May 25 '15 at 09:58

0 Answers0