Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: $("#datepicker").datepicker is not a function

Tags:

jquery-ui

Ive read the other questions about this and I know that this is related to date picker not loaded on the page. however I would like to know how to figure out which functions have loaded with JQuery.

The code I'm using is quite basic so I'm not certain why this is failing anyways:

    <script type='text/JavaScript' src='jquery.js'></script>
    <script type='text/JavaScript' src='jquery.ui.core.js'></script>
    <script type='text/JavaScript' src='jquery.ui.widget.js'></script>
    <script type='text/JavaScript' src='jquery.ui.datepicker.js'></script>
    <script src='jquery.validate.js' type='text/javascript'></script>
    <link href='jquery_ui_base\jquery.ui.all.css' rel='stylesheet' type='text/css'>

    <script type='text/javascript'>
           jQuery(function() {
              calender();
              });

        function calender(){
          $( '#datepicker' ).datepicker()
            }
    </script>
like image 544
user1193752 Avatar asked Sep 19 '12 15:09

user1193752


People also ask

How do I fix TypeError is not a function?

The TypeError: "x" is not a function can be fixed using the following suggestions: Paying attention to detail in code and minimizing typos. Importing the correct and relevant script libraries used in code. Making sure the called property of an object is actually a function.

What is mean by TypeError?

The TypeError object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. A TypeError may be thrown when: an operand or argument passed to a function is incompatible with the type expected by that operator or function; or.

Is not function error in JavaScript?

The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value is not actually a function.

Is not a function TypeError is not a function?

This is a standard JavaScript error when trying to call a function before it is defined. This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the expression did not return a function object.


1 Answers

this usually happens when the jquery core and/or the datepicker js is not being loaded. check if it's loading (a 200 response). Make sure you have the correct paths and proper read permissions.

also, make sure the jquery core is loaded before the datepicker, and that datepicker is loaded before $( '#datepicker' ).datepicker() .

Also, you could try uploading a new version of datepicker.

like image 131
R.D. Avatar answered Oct 06 '22 02:10

R.D.