C# JQuery bundle not loading?
I was having issues with my JQuery script not working in C# Visual Studio 2013
The _Layout.cshtml had the required JQuery bundle in it @Scripts.Render(“~/bundles/jquery”) & BundleConfig.cs had bundles.Add(new ScriptBundle(“~/bundles/jquery”).Include(“~/Scripts/jquery-{version}.js”));
So way the heck doesn’t my script work
Answer because I didn’t surround the script call line with:
@section scripts{ <script src="~/Scripts/ifDeviceAndroidRemovePrintButton.js"></script> }
All because I had this at the top of the view & it was being called before the JQuery bundle loaded, therefore it did not know about JQuery and where to find it.
Moving the call script line to the last loaded item of the view and surrounding it with @Section scripts did the trick.