最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught TypeError: Object [object Object] has no method 'datepicker' - Stack Overflow

programmeradmin1浏览0评论

this is the error i get when trying to use the datepicker widget: *has no method

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

This is the include file i'm using. The confusing part of this is that I use this same includes file on 3 pages and I only get the error on the one page. so it cant really be the script itself...I think

<!-- Datepicker widget -->
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.1.custom.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<link href="css/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" type="text/css" />

any Ideas?

this is the error i get when trying to use the datepicker widget: *has no method

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

This is the include file i'm using. The confusing part of this is that I use this same includes file on 3 pages and I only get the error on the one page. so it cant really be the script itself...I think

<!-- Datepicker widget -->
<script src="js/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.1.custom.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<link href="css/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" type="text/css" />

any Ideas?

Share Improve this question edited Apr 29, 2013 at 0:00 David G 96.8k41 gold badges172 silver badges257 bronze badges asked Apr 28, 2013 at 23:55 user2255811user2255811 4962 gold badges8 silver badges19 bronze badges 7
  • 1 Include the datepicker file above this code. – David G Commented Apr 28, 2013 at 23:56
  • I have this is what it looks like <!-- Datepicker widget --> <script src="js/jquery-1.9.1.js" type="text/javascript"></script> <script src="js/jquery-ui-1.10.1.custom.js" type="text/javascript"></script> <script src="js/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script> <link href="css/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" type="text/css" /> – user2255811 Commented Apr 28, 2013 at 23:57
  • Which one is the datepicker file? – David G Commented Apr 29, 2013 at 0:00
  • 3 You included custom.js twice. (min.js is the same as .js) – Jirka Kopřiva Commented Apr 29, 2013 at 0:05
  • Is it that page in the same directory as other working pages? – plalx Commented Apr 29, 2013 at 0:33
 |  Show 2 more ments

3 Answers 3

Reset to default 12

Fixed there was a jQuery conflict on $ added a jQuery(function($){ which did the trick

Yes, the above solution worked for me too! Here is the plete code for anyone not pletely sure... jQuery(function ($) { $("#datepicker").datepicker(); });

I also had the same issue, it was caused by incorrectly using a mix of primefaces and richfaces - specifically when using p:calendar inside a4j:outputPanel.

Using p:outputPanel instead and removing the a4j namespace resolved the issue.

发布评论

评论列表(0)

  1. 暂无评论