带有jQuery手风琴的向导,上一个/下一个按钮

Ple*_*s81 0 jquery

我正在尝试在手风琴中制作一个向导。看我的代码:

http://jsfiddle.net/NDncE/2/

我做错了什么,我想要每个手风琴元素的上一个和下一个按钮。

小智 5

可以在这里找到使用最新版本的jQuery和jQuery UI的正确解决方案:

http://jsfiddle.net/rmardeni/NDncE/49/

的HTML

<div id="accordion">
    <h3><a href="#">1. Profilbilde</a></h3>
    <div>
        <p>
           test
        </p>
        <button class='next'>
            Next
        </button>
    </div>
    <h3>
        <a href="#">2. Organisasjon</a></h3>
    <div>
        <p>
            test
        </p>
        <button class='previous'>
            Previous
        </button>
        <button class='next'>
            Next
        </button>
    </div>
    <h3>
        <a href="#">3. Tjenestested</a></h3>
    <div>
        <p>
            test
        </p>
        <button class='previous'>
            Previous
        </button>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery代码

jQuery(document).ready(function(){
    $('#accordion').accordion();
    $('#accordion button').click(function(e) {
        e.preventDefault();
        var delta = ($(this).is('.next') ? 1 : -1);
        $('#accordion').accordion('option', 'active', (
             $('#accordion').accordion('option','active') + delta  ));
    });
});
Run Code Online (Sandbox Code Playgroud)