未捕获的TypeError:$(…)。popover不是函数

2024-09-28 20:48:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我在启用popover任何解决方案时遇到此错误,请

这是我的popover函数这有什么问题

$('#popcart').popover();
document.getElementById('popcart').setAttribute('data-bs-content', "<h5> Hello Welcome </h5>");

这是我试图更改数据内容的按钮

<button type="button" class="btn btn-secondary mx-2" animation="true" data-bs-container="body"
             id="popcart" data-bs-html="true" data-bs-toggle="popover" data-bs-placement="bottom"
             data-bs-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
  Cart(<span id="cart">0</span>)
</button>

Tags: 函数idtruedatabs错误buttoncontent
1条回答
网友
1楼 · 发布于 2024-09-28 20:48:00

我最近也遇到了同样的错误,如果您确信库代码已正确导入,则可能有两个或更多jQuery实例或$function。尝试在代码顶部添加noConflict()函数:

<script>
    $.noConflict();
    jQuery( document ).ready(function($) {//Here you can add any code that is using jQuery});
    // And you can use here for other instances of $
</script>

相关问题 更多 >