手风琴激活不起作用

时间:2017-04-21 06:09:05

标签: jquery laravel jquery-ui-accordion

HTML

 $('#file').on('change', function() { $('#form').submit(); });

JS

<div class="faq-left">
    <div class="heading">Common Questions Asked:</div>
    <div class="content-qstions">
        <ul>
            @foreach($questns as $common)
            <li><a href="#" category="{{$common->fk_category}}" id="{{$common->id}}" id="faq-click">{{$common->question}}</a></li>
            @endforeach
        </ul>
    </div>
</div>
<div class="faq-right">
    <div class="tab-blugate">
        <div class="accordion">
        @foreach($faqData as $faqItem)
            <h3>{{$faqItem['category']['name']}}</h3>
            <div>
            @foreach($faqItem['faq'] as $fqaQustn)
                <div class="accordion accordion-inner faqQs{{$fqaQustn->id}}">
                    <h3>{{$fqaQustn->question}}</h3>
                    <div>{!!$fqaQustn->answer!!}</div>
                </div>
            @endforeach
            </div>
        @endforeach 
        </div>
    </div>
</div>

在这里,我想在点击常见问题时激活手风琴的类别和问题。

我尝试使用单击功能nad工作不正常的上述代码。请帮忙解决这个问题。感谢

1 个答案:

答案 0 :(得分:1)

您在课程名称前错过了期间(。)。请尝试以下

var id = $(this).attr('id');
var className = "faqQs"+id;
$('.'+ className).accordion("activate" , 0 );