Search code examples
jqueryformsjquery-callback

my jquery fiddle isn't working


My fiddle only shows part of what I'm trying to do, but since I can't even get the first part to work, I didn't try to add the second part.

First part

There's 2 forms. the second form is invisible because its class is set to "display: none;"

What I want to do is, when you hit "send" on the first form, it fades out, and then the class changes on form2 so that it becomes visible.

My fiddle shows my feeble attempt at this http://jsfiddle.net/mjmitche/KvwGw/

Note, I'm a newbie so please provide as much explanation as possible. (Note, I didn't create proper forms in the fiddle because didn't know where to post them etc)

Second (unattempted) Part

Once the send is clicked on the second form, I want a call back function that fades the second form out as well.

Please help if you can.

Much appreciated!


Solution

  • Here you go. Here is an updated and working one. Hopefully you can tell the difference, let me know if there is anything you don't understand

    http://jsfiddle.net/KvwGw/2/

    Second part

    $('#form2').submit(function() {
        // add form submit stuff in there
    
        $(this).fadeOut(); //fades out form
        return false; //prevents form from submitting to the form action
    
    });