0

我正在创建一个由三部分组成的表单。我想通过单击“下一步”按钮而不是单击 jquery 的标题部分来切换到其他形式。我已经在表单中实现了 jquery 手风琴,并通过下一个和后退按钮转移到其他。但我不能隐藏手风琴的链接或标题。我想隐藏那个链接(手风琴的标题)提前谢谢

<h1 class="top bottom"><span>Help me</span> Buy and Sell a House</h1>
<h2>This form is quick &amp; easy to complete - in only 3 steps!</h2>

<form name="cmaForm" id="cmaForm" method="post">

    <input type="hidden" name="recordRequestPrimaryServiceID" id="recordRequestPrimaryServiceID" value="100" />
    <input type="hidden" name="recordClientServices" id="recordClientServices" value="1,3" />

    <ul id="stepForm" class="ui-accordion-container">
    <li id="sf1">
        <a href='#' class="ui-accordion-link"> </a>
        <div>
            <div class="buttonWrapper">
                <input name="formNext1" type="button" class="open1 nextbutton" value="Next" alt="Next" title="Next" />
            </div>
        </div>
    </li>
    <li id="sf2">
        <a href='#' class="ui-accordion-link"></a>
        <div>
            <div class="buttonWrapper">
                <input name="formBack0" type="button" class="open0 prevbutton" value="Back" alt="Back" title="Back" />
                <input name="formNext2" type="button" class="open2 nextbutton" value="Next" alt="Next" title="Next" />
            </div>
        </div>
    </li>
    <li id="sf3">
        <a href='#' class="ui-accordion-link"></a>
        <div>
            <div class="buttonWrapper">
                <input name="formBack1" type="button" class="open1 prevbutton" value="Back" alt="Back" title="Back" />
                <input name="submit" type="submit" id="submit" value="Submit" class="submitbutton" alt="Submit" title="Submit">
            </div>
        </div>
    </li>
</form>

在javascript中,我对按钮单击事件进行编码以在不同形式之间切换

 <script>
        $(document).ready(function(){
            //display the form in the accordion
            var accordion = $('#stepForm').accordion();
            var current = 0;

            $('.open1').on('click',function(){
                accordion.accordion("option", "active", 1);
                current = 1;
            });

            $('.open2').on('click',function(){
                accordion.accordion("option", "active", 2);
                current = 2;
            });

            $('.open3').on('click',function(){
                accordion.accordion("option", "active", 3);
                current = 3;
            });

            $('#sf3 .prevbutton').on('click', function(){
                accordion.accordion("option", "active", 1);
                current = 1;
            });

            $('#sf2 .prevbutton').on('click', function(){
                accordion.accordion("option", "active", 0);
                current = 0;
            });
 });
    </script>

但现在用户也可以通过单击标题在各种形式之间切换。我想禁用或隐藏(最好)该功能。

4

1 回答 1

0

您可以禁用手风琴的事件。您的按钮点击代码仍然有效。

accordion.accordion({event: false});

我还在这一行中添加了这样的标题,当您悬停时,标题看起来不像链接。您可以为此修改css

$('.ui-accordion-header').css('cursor', 'default');

http://jsfiddle.net/Z9PbM/

于 2013-07-25T04:41:43.890 回答