views:

19

answers:

1

I downloaded the daterangepicker available here : filament group

I am using jQuery 1.4.x version in my page, and all other plugins I am using are supported only on latest version of jQuery. The daterangepicker tool fails because it is using date.js (which uses a very old jQuery).

If I use datepicker, all other plugins and functionality of rest of the plugins I am using are lost.

I went through filament group's comments and found this :

@ Mckensy: We made sure to use “jQuery” instead of $ to prevent such collisions but it appears the date.js library uses $, which is probably causing your conflict. Maybe you could try replacing their $ variables with something else.

he means that noConflict mode doesn't work and only way is to change date.js.

Now can someone please tell me how to do what he says ??

A: 

Try wrapping your date.js code in a (function(){})() and inside this function at the end all the date.js code, assign a global variable so you can reference the local data.js $ variable.

(function() {

// date.js code
var $ = someDataJsStuff();

// .. more code ..

// make a global var to reference this date.js stuff (not $ of course)
dateJsVariable = $;

})();

This will avoid any namespace cluttering. Only that final global variable will clutter so that you can use the library :)

Luca Matteis
I didn't quite understand that "assign a global variable so you can..." part :( Are you asking me to put "all" the codes of date.js in an anonymous function and leave it at that ?
Shrinath
well, I moved to keith-woods datepicker... has a cool one too... But lets keep this thread open and find an answer, for those who are struggling with it... I will try all the solutions posted here...
Shrinath