0

我无法在我的站点中修复 datepicker。我得到的错误是 Uncaught TypeError: Object [object Object] has no method 'datepicker'。我的代码是

<head>
<script src="{{ STATIC_URL }}scripts/modernizr-2.0.6.min.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-1.9.1.min.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-ui.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function () {
    $( "#datepicker" ).datepicker({
      showOn: "button",
      buttonImage: "{{ STATIC_URL }}images/icon.png",
      buttonImageOnly: true
    });
  }); 
</script>
</head>

它正在调度错误“Uncaught TypeError: Object [object Object] has no method 'datepicker'”。我能得到解决方案吗?

谢谢

4

2 回答 2

1

不要两次导入 jQuery 库。

这是所有此类问题的主要原因

于 2013-10-13T12:11:55.037 回答
0

尝试这个

<head>
<script src="{{ STATIC_URL }}scripts/modernizr-2.0.6.min.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-1.9.1.min.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-ui.js"></script>
<script src="{{ STATIC_URL }}scripts/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function () {
var jq = $.noConflict();
    $( "#datepicker" ).datepicker({
      showOn: "button",
      buttonImage: "{{ STATIC_URL }}images/icon.png",
      buttonImageOnly: true
    });
  }); 
</script>
</head>    
于 2013-06-03T11:09:12.927 回答