问题描述
当我在现有的 .aspx 页面中使用 jQuery 的 UI 插件 DatePicker 时,我收到以下错误:
When i use DatePicker, jQuery's UI plugin, in an existing .aspx page I get errors that:
$("#datepicker").datepicker is not a function
但是,当我将创建和使用 datePicker 的相同代码复制并粘贴到与 aspx 页面位于同一目录中的 HTML 文件中时,它可以完美运行.这让我假设 aspx 页面中有一些 JS 文件阻止 datePicker 或 jQuery 的 UI JS 文件正确加载.
However, when I copy and paste the same code that creates and uses the datePicker to an HTML file that's also in the same directory as the aspx page, it works flawlessly. This leads me to assume that there are some JS files in the aspx page that's preventing the datePicker or maybe jQuery's UI JS files to load properly.
谁能证实我的看法或提供任何提示来找出干扰 jQuery 的 UI 插件的罪魁祸首?
Can anyone confirm my beliefs or provide any tips on finding the culprit that's interfering with jQuery's UI plugins?
推荐答案
我为类似的问题苦苦挣扎了好几个小时.后来发现,jQuery 被包含了两次,一次是我添加 jQuery 函数的程序,一次是我们的内部调试器.
I struggled with a similar problem for hours. It then turned out that jQuery was included twice, once by the program that I was adding a jQuery function to and once by our in-house debugger.
这篇关于jQuery 用户界面$(“#datepicker").datepicker 不是函数"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!