user1234
user1234

Reputation: 3159

jquery timepicker throws:Uncaught TypeError even after including the necessary files

I am trying to call the timepicker function, but it constantly throws:

Uncaught TypeError: jQuery(...).timepicker is not a function(…)

I see the file loaded in the network, but cant access the timepicker function.I also have jquery and jquery-ui loaded before this file gets loaded. Here is how im including the script:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.8.9/jquery.timepicker.js"></script>

js:

    $("#timestart").timepicker();

html:

<label>Start Date</label>
<input type="text" id="timestart"/>

I have been struggling to find out where im going wrong. any clue why does the timepicker function is not accessible and throws error?

Thanks!

Upvotes: 1

Views: 58

Answers (1)

Matt
Matt

Reputation: 4752

Did you include the jquery.timepicker.css file as well?

I used your same code in this working fiddle.

<label>Start Date</label>
<input type="text" id="timestart"/>

and

 $("#timestart").timepicker();

Upvotes: 1

Related Questions