Jquery UI Tabs: Next and Previous enable/disable based on select boxes

前端 未结 1 1004
孤街浪徒
孤街浪徒 2021-01-25 14:27

I am currently working with Jquery UI tabs that I have only operating with next/previous buttons(this will force the user to go through the tabs in order). In my first tab I hav

1条回答
  •  [愿得一人]
    2021-01-25 14:51

    Ok, this is untested. Only change the tab on next/previous click, if you are not on the first tab (1) or the really last tab exist and an option (except the neutral) is choosen (2).

    $('.next-tab, .prev-tab').click(function() {
        var tabIndex = $(this).attr("rel");
        if (
            /*(1)*/ $('#tabs').tabs('option', 'selected') > 0 ||
            /*(2)*/ ($('.update.last').length > 0 && parseInt($('.update.last').val(), 10) > 0)
        ) {
            $tabs.tabs('enable', tabIndex)
                .tabs('select', tabIndex)
                .tabs("option","disabled", [0, 1]);
        }
        return false;
    });
    

    Good luck and see you tomorrow :-)

    0 讨论(0)
提交回复
热议问题