无法读取空引导折叠的属性“querySelectorAll”
2022-08-30 17:04:03
我正在为引导折叠编写php代码,并采取错误无法读取空值的属性“querySelectorAll”。我花了很多时间在这个简单的问题上。如果我放没有php,这是工作真正规范没有错误错误是:
Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at a.t._getParent (collapse.js:300)
at new a (collapse.js:88)
at HTMLDivElement.<anonymous> (collapse.js:345)
at Function.each (jquery.js:368)
at jQuery.fn.init.each (jquery.js:157)
at jQuery.fn.init.a._jQueryInterface [as collapse] (collapse.js:331)
at HTMLDivElement.<anonymous> (collapse.js:378)
at Function.each (jquery.js:368)
at jQuery.fn.init.each (jquery.js:157)
at HTMLButtonElement.<anonymous> (collapse.js:374)
这是我的php代码
<div id="info-content" class="accordion" id="accordionExample">
<?
$faqs = get_field('faqs');
foreach ($faqs as $key => $value):
?>
<div class="card">
<div class="card-header" id="headingOne<?=$key;?>">
<h5 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne<?=$key;?>" aria-expanded="true" aria-controls="collapseOne<?=$key;?>">
<?=$value['question'];?>
</button>
</h5>
<i class="fas fa-plus"></i>
</div>
<div id="collapseOne<?=$key;?>" class="collapse <?if($key==0):?>show<?endif;?>" aria-labelledby="headingOne<?=$key;?>" data-parent="#accordionExample">
<div class="card-body">
<?=$value['answer'];?>
</div>
</div>
</div>
<?endforeach;?>
</div>