0
HTML手風琴激活不工作
<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>
JS
$(".content-qstions li a").click(function(){
var id = $(this).attr('id');
var className = "faqQs"+id;
$(className).accordion("activate" , 0);
});
這裏我要上常見的問題,當點擊激活手風琴兩個類別和問題。
我試了上面的代碼與點擊功能沒有正常工作。請幫助解決這個問題。謝謝
我覺得'$('。'+ className)''會工作 –