Uncaught TypeError: $(...).bootstrapTable is not a function

网上解决方案:

1:js的引用顺序问题

2:jq重复引用

3:js引用版本不一致

这里是第二个问题,创建的asp.net mvc项目,bootstrap-table的页面引用了jq,_Layout.cshtml也有

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")

_Layout的引用初始在body最后,可以引用放到body开始在@RenderBody()前,这样其他页面不需要再引用了;或者删除_Layout引用,但其他页面都需要加这个引用

 

ps:刚开始保留了_Layout引用,但报错:

bootstrap-table.min.js:10 Uncaught TypeError: Cannot set properties of undefined (setting 'BootstrapTable')

(index):79 Uncaught ReferenceError: $ is not defined

然后_Layout引用放到@RenderBody()前边就行了

 

参考:https://www.cnblogs.com/SmallChen/p/16139973.html

https://blog.csdn.net/dongli5012/article/details/81510372

https://blog.csdn.net/lucasmaluping/article/details/101343839

posted @ 2022-12-07 09:40  户的博客  阅读(1041)  评论(0编辑  收藏  举报