[英]Why scripts don't work when I click on a button?
I have a button which when user click on it, phone numbers will be appear slowly.我有一个按钮,当用户点击它时,电话号码会慢慢出现。
Here is the HTML Codes:这是 HTML 代码:
<span id="show-phone-numbers" href="#tab4" data-bs-toggle="tab" class="btn btn-success">
<i class="fe fe-phone-call"></i> Show Phone Number
</span>
<div class="media margin-top-20" id="phone-number-section" style="display:none">
<div class="media-body text-center">
<a href="tel:00000000">
<p class="btn btn-outline-primary">
<i class="fe fe-phone-call"></i> somephonenumber
</p>
</a>
<a href="tel:00000000">
<p class="btn btn-outline-primary">
<i class="fe fe-phone-call"></i> somephonenumber
</p>
</a>
</div>
</div>
And here is the scripts:这是脚本:
$("#show-phone-numbers").on("click",function(){
$("#phone-number-section").toggle("slow");
});
The problem is when I click on the "Show Phone Number" button, I get this error in the console:问题是当我单击“显示电话号码”按钮时,我在控制台中收到此错误:
enter image description here在此处输入图像描述
And (bootstrap-rtl.js:1031:35) is the code below:并且(bootstrap-rtl.js:1031:35)是下面的代码:
children(element, selector) {
return [].concat(...element.children).filter(child => child.matches(selector));
},
I did search about the error but I couldn't find a way which help me to handle this error.我确实搜索了该错误,但找不到帮助我处理此错误的方法。
Why do you have data-bs-toggle="tab"
in there, without any bootstrap tab elements?为什么你有
data-bs-toggle="tab"
在那里,没有任何引导选项卡元素? This causes the BS event handler to be registered, which throws this error, because it can't find properly setupped tabs.这会导致注册 BS 事件处理程序,从而引发此错误,因为它找不到正确设置的选项卡。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.