Click here to Skip to main content
15,891,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is the vsdoc bundle I've added to BundleConfig, and have rendered the scripts in _Layout.cshtml. Yet I couldn't get the jquery intellisense working on the views. The only way i've got it working thus far is by pasting a reference to the view where I'm using Jquery. The other thing is that even an alert box doesn't work if I render the scripts above the `</body>` in _Layout.cshtml. However, it works if I render it in the `<head>` tag. Why is it ? Any help would be greatly appreciated - thanks

**BundlesConfig**
bundles.Add(new ScriptBundle("~/bundles/jqueryIntellisense").Include(
"~/Scripts/jquery-{version}-vsdoc.js"));

**Layout**
      @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/jqueryIntellisense")
    @Scripts.Render("~/bundles/modernizr")
    @RenderSection("scripts", required: false)
</body>
</html>
     **View**
<script>
    $(document).ready(function () { alert("hello"); });
</script>
Posted
Updated 22-Feb-13 5:39am
v2

1 solution

The Scripts.Render is loading the JavaScript scripts async, so there is no way to predict if jQuery is loading first or second or last.
The solutin is to go back to the "old" way of loading the scripts:

<script type="text/javascript" src="../Scripts/jquery-1.8.2.min.js"></script>

Although it is not an elegant solution and you have to manualy update the version of the script at least this way it works.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900