longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Error "Cannot read property 'contains' of undefined" is thrown in a page without any calendar #437

Open MiguelAngel82 opened 6 years ago

MiguelAngel82 commented 6 years ago

Hello all,

I'm using the daterangepicker (last version) in a Grails application. This library has been added to a main JS file, named as application.js. This file is used by Asset Pipeline plugin and requires jQuery and moment before using daterangepicker. This file is also loaded in the bottom of the page.

When the main view of the app is loaded, this error is thrown, when you clicked in some page area:

jquery.daterangepicker.js?compile=false:5565 Uncaught TypeError: Cannot read property 'contains' of undefined
    at IsOwnDatePickerClicked (jquery.daterangepicker.js?compile=false:5565)
    at HTMLDocument.outsideClickClose (jquery.daterangepicker.js?compile=false:7113)
    at HTMLDocument.dispatch (jquery-2.2.0.min.js?compile=false:3)
    at HTMLDocument.r.handle (jquery-2.2.0.min.js?compile=false:3)

Maybe is a problem in load order or something similar.

Any help is appreciate :)

Thank you.

Regards, Miguel.

ArjunKishore commented 5 years ago

I am having the same issue. Wondering if you have found any solution?

mennwebs commented 5 years ago

I'm having this issue, too. Do you have any solution?

MiguelAngel82 commented 5 years ago

Hello @ArjunKishore (sorry for the very late reply) amd @MennStudio.

Sorry but I haven't tried if this issue is still happening. When I tried it, I haven't found any solution.

I'm apologize the inconvenience.