chandu
chandu

Reputation: 3

Uncaught TypeError: undefined is not a function(anonymous function) for datepair();

<link type="text/css" href="css/jquery-ui.min.css" rel="stylesheet" />
<link type="text/css" href="css/jquery.timepicker.css" rel="stylesheet" />
<link type="text/css" href="css/site.css" rel="stylesheet" />
<link type="text/css" href="css/bootstrap-datepicker.css"
rel="stylesheet" />

<body>
<p id="datepairExample">
    <input type="text" class="date start" /> <input id="abc" type="text"
        class="time start" />
</p>

</body>
<!--   <script type="text/javascript" src="js/datepair.js"></script> -->
<script type="text/javascript" src="js/jquery.datepair.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<script type="text/javascript" src="js/site.js"></script>
<script type="text/javascript" src="js/bootstrap-datepicker.js"></script>


<script>
    // initialize input widgets first

    $('#datepairExample .time').timepicker({
        'showDuration' : true,
        'timeFormat' : 'g:ia'
    });
    var x = new Date();
    $('#datepairExample .time').timepicker({
        'disableTimeRanges' : [ [ '12am', x ] ]
    });

    $('#datepairExample .date').datepicker({
        'format' : 'yyyy-m-d',
        'autoclose' : true
    });

    // $( "#datepicker" ).datepicker({ minDate: 0});
    $(function() {
        $("#datepairExample .date").datepicker({
            numberOfMonths : 3,
            showButtonPanel : true,
            minDate : x
        });
    });
    // initialize datepair
    $('#datepairExample').datepair();
</script>

I am planning to disable all the previous dates in the calendar, I followed few examples online and for some reason I get Uncaught TypeError: undefined is not a function (anonymous function), in my console. I tried my best to fix it, but I couldn't, anyone who can solve this would serve a great help to me. Thanks.

Upvotes: 0

Views: 1141

Answers (1)

void
void

Reputation: 36703

Your scripts are not properly ordered. jquery.min.js should be the first.

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.datepair.js"></script>
...

Upvotes: 1

Related Questions