Question

I'm a little stumped here. My website uses a little Jquery. The SlideShow and now I want to also add the DatePicker.

<script src="~/Scripts/1.9.1.js"></script>    
<script src="~/Scripts/jquery-ui-1.10.4.js"></script>        
<script src="~/Scripts/jTools.js"></script>
<script src="~/Scripts/script.js"></script> // all of my onDocumentReady scripts

The DatePicker does not work. Firebug reports:

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

The code I use to call the function is

<script>
    $(function () {
        $(".datepicker").datepicker({
            dateFormat: 'dd/mm/yy'
        });
    });
</script>

If I update my scripts by removing the last 2, then the DatePicker works fine

<script src="~/Scripts/1.9.1.js"></script>    
<script src="~/Scripts/jquery-ui-1.10.4.js"></script>        
<!--<script src="~/Scripts/jTools.js"></script> REMOVED
<script src="~/Scripts/script.js"></script>  REMOVED -->

I have no idea how I can work out where the issue is.

The jTools.js is a library from http://jquerytools.org/download/

My script.js only contains

$(function () {
    $("a[rel]").overlay();
    document.getElementById("ringBackMorning").text = GetTomorrow() + " morning";
    document.getElementById("ringBackAfternoon").text = GetTomorrow() + " afternoon";

    $('#ddmenu li').hover(function () {
        clearTimeout($.data(this, 'timer'));
        $('ul', this).stop(true, true).slideDown(100);
    }, function () {
        $.data(this, 'timer', setTimeout($.proxy(function () {
            $('ul', this).stop(true, true).slideUp(400);
        }, this), 100));
    });

    // select all desired input fields and attach tooltips to them
    $("#ringMeBack :input").tooltip({
        // place tooltip on the right edge
        position: "center right",
        // a little tweaking of the position
        offset: [-2, 10],
        // use the built-in fadeIn/fadeOut effect
        effect: "fade",
        // custom opacity setting
        opacity: 0.7
    });
});

I'm happy to show the web page this is occuring on but not sure if that's an OK thing to do or not...

EDIT

As per the comments by @web-nomad and @Bill Criswell I re-downloaded JQuery Tools and ensured it was not bundled with JQuery. I then re-downloaded the latest version of JQuery (1.11.1) that I could use.

This gives me the issue of TypeError: a.browser is undefined as well as the original issues (jstools line 427)

Was it helpful?

Solution

Run jQuery.fn.jquery in the console and see what version number that returns. If it's not 1.9.1 the jTools library is including its own version of jQuery which in turn is removing the jQuery UI library since it's overwriting the current jQuery version, leaving you with an older version of jQuery.

You should probably rebuild jTools (if you even need it after including jQuery UI) to NOT include jQuery.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top