asp.net-mvc – Asp.Net MVC中的JQuery UI datepicker

我试图在Asp.Net MVC网站上使用JQuery UI中的一些小部件,没有运气.

例如jQuery UI – functional demos的基本datepicker.

我创建了一个简单的MVC项目,并在Site.Master中添加了脚本引用,如下所示:

<script src="../../Scripts/jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui-personalized-1.5.3.min.js" type="text/javascript"></script>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<link href="../../Content/ui.datepicker.css" rel="stylesheet" type="text/css" />"

在Index.aspx文件中,我已经清除了所有内容,并添加了以下内容

<script type="text/javascript">
    $("#basics").datepicker();     
</script>  
<input type="text" size="10" value="click here" id="basics"/>

核心的jQuery工作正常.任何线索?

解决方法

确保在加载DOM后调用初始化程序:
$(document).ready(function() {
    $("#basics").datepicker();
});

jQuery ready event

By using this method,your bound function will be called the instant the DOM is ready to be read and manipulated,which is when 99.99% of all JavaScript code needs to run.

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....