Using the Twitter Bootstrap Template with ASP.NET MVC 4 Requires jQuery Update
The Gist: Bootstrap.js depends on jQuery v1.7 or higher. The current ASP.NET MVC4 template installs jQuery v1.6.2.
The Long Story
After successfully creating my MVC 4 application, adding a Cloud Service project, successfully configuring, publishing and testing my new cloudapp deployment to Windows Azure, all of my bits in place right? Not so fast.
Today, if I am not rolling out a custom Orchard CMS build, then I will typically use HTML5 Boilerplate or Twitter Bootstrap as the site design templates of choice. Primarily because as a LOB developer, I’m not so much a designer and so any assets along these lines makes for a great day of work for me.
For my current project, I decided on Twitter Bootstrap and after porting the layout and styles to the _Layout.cshtml file I thought that I was ready to rock. However, each time that I ran the application, I was presented with the following error message:
In essence, “Object doesn’t support property or method ‘on’”. Because I’ve become so accustomed to jQuery dependencies working out of the box, it didn’t immediately occur to me that there could be a jQuery version issue. So I spent some time debugging and tweaking my code, thinking that perhaps I didn’t quite bundle the scripts correctly or something like that. After about an two hours with no success, I decided to “bingit!” (yes, I actually do use Bing). I found the resource that I needed right in the twitter/bootstrap forum on github. The gist: Bootstrap.js depends on jQuery v1.7 or higher.
While this was an easy fix and Mark Otto (creator of Bootstrap) has done an awesome job with the platform, I still think that it would be cool to add a note somewhere on the project homepage of its dependencies.
Get it to the cloud…fast!
Comments
Comments are closed