VS的MVC项目,为什么调用jQuery的语法没有效果

张天星 2018-06-23 10:48:44
VS中创建新的MVC项目,自带了jQuery-3.3.1.min.js的文件。
我在cshtml中调用了这个文件,但是却没有效果。

@{
Layout = "";
}
<h2>jQuery的学习</h2>
<script src="~/Scripts/jquery-3.3.1.min.js"></script>
@*<script src="~/Scripts/APP.js"></script>*@
<script>
$(document).ready.(function () {
alert("文档加载完毕");
$("p").click(function () {
$(this).hide();
});
});
</script>

<body>
<p>hello1</p>
<p>hello2</p>
<p>hello3</p>
<p>hello4</p>
<p>hello5</p>
<p>hello6</p>
</body>

那个jquery的语法,本来是写在APP.js里面的,但是不生效。
于是我复制到html里面,还是不生效。
各位帮我看看,我这个语法。。。应该没有问题吧。
有什么可能的错误原因么。
...全文
210 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
张天星 2018-06-24
  • 打赏
  • 举报
回复
引用 1 楼 ambit_tsai 的回复:
$(document).ready.(function ()
这一句错了,ready后面的点去掉

不小心用小号回复了。
多谢了,解决了这个问题。。
qq_42531277 2018-06-24
  • 打赏
  • 举报
回复
引用 1 楼 ambit_tsai 的回复:
$(document).ready.(function ()
这一句错了,ready后面的点去掉

多谢,一字千金啊,我半天没有找到。
唉,VS对HTML的支持太差了,这个都没有任何错误提示。
ambit_tsai-微信 2018-06-23
  • 打赏
  • 举报
回复
$(document).ready.(function () 这一句错了,ready后面的点去掉
An outstanding author team presents the ultimate Wrox guide to ASP.NET MVC 4 Microsoft insiders join giants of the software development community to offer this in-depth guide to ASP.NET MVC, an essential web development technology. Experienced .NET and ASP.NET developers will find all the important information they need to build dynamic, data-driven websites with ASP.NET and the newest release of Microsoft's Model-View-Controller technology. Featuring step-by-step guidance and lots of code samples, this guide gets you started and moves all the way to advanced topics, using plenty of examples. Designed to give experienced .NET and ASP.NET programmers everything needed to work with the newest version of MVC technology Expert author team includes Microsoft ASP.NET MVC insiders as well as leaders of the programming community Covers controllers, views, models, forms and HTML helpers, data annotation and validation, membership, authorization, security, and routing Includes essential topics such as Ajax and jQuery, NuGet, dependency injection, unit testing, extending MVC, and Razor Includes additional real-world coverage requested by readers of the previous edition as well as a new case study example chapter 下面是上一版书的中文介绍 《ASP.NET MVC 3 高级编程》主要内容是描述视图的概念,探讨Razor语法、NuGet、单元测试等,解释控制器在MVC框架中的作用,以及模型在绑定和数据访问策略中发挥的作用,演示如何显示和处理表单,涵盖添加到April 2011 Tools Update中的新特性,如基架和HTML5项目模板,展示在客户端和服务器端验证模型的过程给出利用成员资格、援权和安全特性的忠告,讲解将TDD应用于ASP.NET MVC的方法。

87,995

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧