使用jquery ui tabs问题启用选项卡

时间:2009-10-16 23:36:10

标签: jquery-ui tabs

我正在尝试启用下面函数末尾的下一个标签。

这是我的功能(更新)

var $signup = $('#signup-content').tabs({disabled: [1,2],
  show: function(event, ui) {
        // Validates Form on Slide # 1
        $("#createAccount").validate({
        meta: "validate",
        errorElement: "em",
                errorClass: "error",
        validClass: "success",
        highlight: function(element, errorClass, validClass) {
            $(element).closest("div.required").removeClass(validClass);
            $(element).closest("div.required").addClass(errorClass);
            $(element).addClass(errorClass);
        },
        unhighlight: function(element, errorClass, validClass) {
            $(element).closest("div.required").removeClass(errorClass);
            $(element).closest("div.required").addClass(validClass);
            $(element).removeClass(errorClass);
        },
        errorPlacement: function(error, element) {
            if (element.attr("name") == "month"
                 || element.attr("name") == "day"
                 || element.attr("name") == "year")
             error.insertAfter("#year");
            else
            error.addClass("hide");
        },
        debug:true,
                groups: {birthday: "month day year"
        },
        rules: {
            firstname:{required:true},
            lastname:{required:true},
            email: {required: true, email: true},
            confirm_email: {required: true, equalTo: "#email"},
            password:{required: true},
            confirm_password:{required: true,equalTo: "#password"},
            zipcode: {required:true, min:5},
            month:{required:true},
            day:{required:true},
            year:{required:true},
            gender:{required:true},
            agree:{required:true}
        },
        messages: {
        month: {required: "Month Is Missing"},
        day: {required: "Day Is Missing"},
        year: {required: "Year Is Missing"}

        },
               submitHandler: function(form) {
            $(form).ajaxSubmit({
             beforeSubmit:  function showRequest(formData, jqForm, options) {
                         var queryString = $.param(formData);
                         alert('About to submit: \n\n' + queryString);
                         return true;
               },
               success: function showResponse(formData) {
                       $('html, body').animate({scrollTop:'0px'}, 500);
                       $signup.tabs('option', 'enabled', [1]); 
                       $signup.tabs('select', 1); // Go To Slide # 2
                       $('#message-container').addClass("notice").append('<h3>Your Account Has Been Created!</h3><a href="javascript:;" id="close"><img src="/assets/images/close.png" alt="Close" title="Close"/></a>');
                       $('#message-container').fadeIn(1200, function(){
                       $('#close').click(function(){$('#message-container').fadeOut(1200);});});
                       return false;}});}}); 

2 个答案:

答案 0 :(得分:3)

这对我有用,至少在版本1.7:

$signup.tabs('enable', 1);

答案 1 :(得分:1)

根据instructions,您无法使用:

$signup.tabs('option', 'enabled', [1]);

但改为使用:

$signup.data('disabled.tabs', []);

这样做可以清除已禁用的标签列表。