How to insert jQuery code? Uncaught ReferenceError: $ is not defined in view razor code

前端 未结 5 1930
执念已碎
执念已碎 2020-12-31 06:54

I have the following Asp.Net MVC 4 razor code at the end of the file.

....
@section Scripts {
    @Scripts.Render(\"~/bundles/jqueryval\")
}



        
5条回答
  •  Happy的楠姐
    2020-12-31 07:04

    Your Script is called before the jquery is even loaded so it doesn't know what $ means. Try having the jquery scripts loaded in the head section of your layout file.

提交回复
热议问题