JQuery Tabbed Nav Menu and PHP Forms Question?

Posted by SlAcKeR on Stack Overflow See other posts from Stack Overflow or by SlAcKeR
Published on 2010-03-18T23:59:14Z Indexed on 2010/03/19 0:01 UTC
Read the original article Hit count: 230

Filed under:
|

I'm using a JQuery Tabbed Menu which holds different types of forms and when I select a different form located under a different tab and submit the form the tab will jump to the default tab instead of the current tab the form is located in.

I was wondering how would I go about fixing this so that when the form is submitted the current tab is still selected, is it the JQuery or PHP problem?

Here is the JQuery.

$(document).ready(function() {

    //When page loads...
    $(".form-content").hide(); //Hide all content
    var firstMenu = $("#home-menu ul li:first");
    firstMenu.show();
    firstMenu.find("a").addClass("selected-link"); //Activate first tab
    $(".form-content:first").show(); //Show first tab content

    //On Click Event
    $("#home-menu ul li").click(function() {

        $("#home-menu ul li a").removeClass("selected-link"); //Remove any "selected-link" class
        $(this).find("a").addClass("selected-link"); //Add "selected-link" class to selected tab
        $(".form-content").hide(); //Hide all tab content

        var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the selected-link tab + content
        $(activeTab).fadeIn(); //Fade in the selected-link ID content
        return false;
    });

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about php