I'm using bootstrap to collapse parts of my website. It all works fine. But when I try to control the behaviour manually by javascript, it does not work
for example when I do this:
$(".collapse").collapse('hide');
or exactly this:
$(".collapse").each(function () {
if (localStorage.getItem(this.id)) {
$(this).collapse('hide');
}
it does not work. I get this error: Object doesn't support property or method 'collapse' bootstrap.
I saw similar examples online. What am I doing wrong? Thanks for any help.
Update:
The Problem was related to different jquery-versions in my asp.net mvc project. Removing this line of code from _Layout.cshtml fixed it:
@Scripts.Render("~/bundles/jquery")
The Problem was related to different jquery-versions in my asp.net mvc project. Removing this line of code from _Layout.cshtml fixed it:
@Scripts.Render("~/bundles/jquery")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With