加载时的jQuery datepicker表示未定义。 [英] jQuery datepicker when loaded says undefined.

查看:125
本文介绍了加载时的jQuery datepicker表示未定义。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以我的形式实现日期选择器,但是当添加日期选择器的代码不显示在酿酒者中时。当控制台被检查时,这个错误被发布
TypeError:'undefined'不是一个函数(评估'$(#datepicker).datepicker()')
jQuery库文件被添加到根文件夹。

Im trying to implement a date picker in my form however when the code it added the date picker does not display in the brewers. When the console is inspected this error is posted TypeError: 'undefined' is not a function (evaluating '$( "#datepicker" ).datepicker()') The jQuery library file is added in the root folder.

Bellow是使用的代码:

Bellow is the code used:

$(document).ready(function() {
$( "#datepicker" ).datepicker();
});

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Datepicker</title>
<link rel="stylesheet" href="jquery-ui-1.10.4.custom.css">
<script src="jquery-1.10.2.js"></script>
<script src="datepicker.js"></script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>


</body>
</html>


推荐答案

您需要添加将调用datepicker的函数为您的输入标签。
将js代码放在文件的末尾。
也不会忘记将这段代码包含在一个将执行的函数中:

you need to add the function that will invoke the datepicker for your input label. put the js code at the end of the file. also don´t forget to include this code this into a function that will execute itself:

<script type="text/javascript">
$(document).ready(function() {
$( '#datepicker' ).datepicker();
});
</script>

<script type="text/javascript">
(function() {
$( '#datepicker' ).datepicker();
})();
</script>

这篇关于加载时的jQuery datepicker表示未定义。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆