I have an MVC 5 application where I need jQuery UI. So I downloaded jQuery UI (Combined Library) version 1.10.4 from NuGet and just to make sure also updated jQuery to version 2.1.1. Next thing I did was to set up the bundles like so:
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui.unobstrusive-{version}.js",
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.all.css"));
And finally render those in my _Layout.cshtml in the following order:
In the head-tag:
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/jquery")
At the bottom then:
@Scripts.Render("~/bundles/jqueryval")
@Scripts.Render("~/bundles/jqueryui")
(Even when I copy the bottom to the head-tag or vice versa - nothing would change)
Now I set up a partial view with the following script at the top of the page:
<script type="text/javascript">
$(function () {
$("#commentSection").accordion();
});
</script>
After typing the "." in $("#commentSection").accordion(); intellisense won't give me any jQueryUI-Element to choose from. And even after starting the app nothing happens. I've tried rendering the scripts and styles at the top of the view, too but with no effect. The same code would work on an MVC 4 test-ap. But there jQuery UI is already included. And yes, I kept pressing the "build solution" menu-entry like crazy... :P
So what am I doing wrong? Thanks for helping out.