jQuery daterangepicker throwing invalid function error

764 views Asked by At

I am trying to using daterangepicker.

What I am trying to do is using a server side datatable, so I have bound my server call on each input field. But I was using date from and date to, datatable is not able to take the value of both date from and date to.

It returns the value of one at a time and on same key.

So I went for daterangepicker, which would be one component.

 table.columns().every(function() {
            var that = this;
            $("input", this.header()).on('keyup change', function() {
                that.search(this.value).draw();
            }); 
            $('select', this.header()).on('keyup change', function() {
                that.search(this.value).draw();
            });
        });

What it should be doing is accepting the start date and end date.

jQuery code:

$('#reportrange').daterangepicker({
            format : 'DD/MM/YYYY'
});

HTML markup:

<input type="text" style="width: 200px" name="reportrange" id="reportrange" class="form-control" />

but it is should invalid function daterangepicker

TypeError: $(...).dateRangePicker is not a function

$('#reportrange').dateRangePicker({ can anyone has solution to my problem.

Can anyone help?

1

There are 1 answers

2
Pavel Němec On

If you have included jQuery, moment.min.js and jquery.daterangepicker.js then just rewrite name of the function to dateRangePicker. Remember that javascript is case sensitive.

$('#reportrange').dateRangePicker({
    format : 'DD/MM/YYYY'
});