Javascript 模态表单选项卡导航

Javascript 模态表单选项卡导航,javascript,jquery,Javascript,Jquery,我不知道我做错了什么。这里有一个链接来查看示例。 我的“上一个”和“下一个”按钮可以工作,但如果用户按“上一个”或“下一个”,我不知道如何更改选项卡。 谢谢你抽出时间。 $(文档).ready(函数(){ 您可以触发click事件,并使用已经在click侦听器中实现的逻辑。我将使用类activetab,而不是id $(document).ready(function(){ //When someone clicks on the navigation links $('.nav li').cli

我不知道我做错了什么。这里有一个链接来查看示例。 我的“上一个”和“下一个”按钮可以工作,但如果用户按“上一个”或“下一个”,我不知道如何更改选项卡。 谢谢你抽出时间。 $(文档).ready(函数(){


您可以触发click事件,并使用已经在click侦听器中实现的逻辑。我将使用类
activetab
,而不是id

$(document).ready(function(){
//When someone clicks on the navigation links
$('.nav li').click(function(e){
    $('.nav li').removeClass("activetab"); //make all navtabs inactive
    $(this).addClass("activetab"); //make the one we clicked active

    //hide all of the fieldsets
    $('fieldset').addClass("myHidden");

    var whichitem=$(this).attr('title'); //get the title of the nav we clicked

    //make the class of what we cleared not hidden
    $("fieldset[title='"+whichitem+"']").removeClass("myHidden");
});


//When someone clicks on the previous button
$('.prev').click(function(e){
    // trigger the click
    $(".activetab").prev().click();
});


//When someone clicks on the next button
$('.next').click(function(e){
    // trigger the click
    $(".activetab").next().click();
});
});

感谢您的快速回复,因为某些原因,我仍然不工作。
$(document).ready(function(){
//When someone clicks on the navigation links
$('.nav li').click(function(e){
    $('.nav li').removeClass("activetab"); //make all navtabs inactive
    $(this).addClass("activetab"); //make the one we clicked active

    //hide all of the fieldsets
    $('fieldset').addClass("myHidden");

    var whichitem=$(this).attr('title'); //get the title of the nav we clicked

    //make the class of what we cleared not hidden
    $("fieldset[title='"+whichitem+"']").removeClass("myHidden");
});


//When someone clicks on the previous button
$('.prev').click(function(e){
    // trigger the click
    $(".activetab").prev().click();
});


//When someone clicks on the next button
$('.next').click(function(e){
    // trigger the click
    $(".activetab").next().click();
});
});