2

我在 jQuery UI Accordion 中有一个表单。

使用此代码,访问者必须验证第一个面板,然后才能打开下一个手风琴面板。但是,如果访问者想要返回第一个面板,它不会放手。

$(document).ready(function () {

    $("#accordion").accordion({ event: false });

    $('#openfirst').click(function () {

        if (varification is okay then) {

            $("#accordion").accordion({ active: 1 });

                // cancel submit
                return false;

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

        $('#opensecond').click(function () {


            if (varification is okay then) {

                $("#accordion").accordion({ active: 2 });

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

        $('#openthird').click(function () {

            if (varification is okay then) {

                $("#accordion").accordion({ active: 3 });

                // cancel submit
                return false;

            } else {

                alert('Please acknowledge the following before proceeding.');

            }

        });

    });
</script>
4

1 回答 1

0

而不是使用

$("#accordion").accordion({ event: false });

尝试使用

$( ".selector" ).accordion( "disable" );

并在用户验证后,使用

$( ".selector" ).accordion( "enable" ); //for manual operation of tabs

或者

$( ".selector" ).accordion({ active: # }); //for code generated operation of tabs
于 2013-09-16T12:59:27.700 回答