简体   繁体   English

ASP.NET Core:在视图中包含 jquery

[英]ASP.NET Core : include jquery in a view

I used Bower to download jquery in my ASP.NET Core project, and here's my project structure :我使用Bower在我的 ASP.NET Core 项目中下载jquery ,这是我的项目结构:

项目树结构

Now, I want to include jquery in my view, and it's not working.现在,我想在我的视图中包含 jquery,但它不起作用。 I tried :我试过 :

<script src="bower_components/jquery/dist/jquery.js"></script>

but in vain.但徒劳无功。

Default location for the bower file is like凉亭文件的默认位置就像

{
  "directory": "wwwroot/lib"
}

so you can reference them llike所以你可以参考它们

<script src="~/lib/jquery.js"></script> 

and also you can modify it, see the asp.net core documentation你也可以修改它,见asp.net核心文档

Documentation文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM