Samuel Tang
Samuel Tang

Reputation: 463

Uncaught Type Error: Object[object Object] has no method timepicker

Hi there i am trying to implement a basic timepicker example and I encounter: Uncaught Type Error: Object[object Object] has no method timepicker

Code:

<!DOCTYPE html>
<html>
  <head>
    <link type="text/css" href="js/jquery.ui.timepicker.css" rel="stylesheet" /> 
    <!--<script type="text/javascript" src="js/jquery.ui.timepicker.js"></script>-->
    <script type="text/javascript" src="js/jquery.timepicker.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript">
     $(document).ready(function(){
        $('#id1').timepicker();
     });
    </script>
  </head>

  <body>
    Input: <input id="id1" type="text" name="fullname"><br>
  </body>
 </html>

Upvotes: 0

Views: 1443

Answers (2)

tymeJV
tymeJV

Reputation: 104775

Load jQuery first!

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.timepicker.min.js"></script>

Upvotes: 0

krishwader
krishwader

Reputation: 11371

The order of priority must be the following:

  1. jQuery.js
  2. Everything that depends on jQuery.

It looks like you got that wrong (looking at your code in the question). Change it to this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.timepicker.min.js"></script>

Upvotes: 2

Related Questions