0

I'm trying to get working jQuery UI and prototype libraries together and finally arrived to this:

<script type="text/javascript" src="/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/js/scripts.js"></script>
<script type="text/javascript" src="/js/prototype.js"></script>
<script>
    var jq = jQuery.noConflict();
    // Code that uses other library's $ can follow here.
</script>
<script src="/js/jquery-ui.js"></script>

And call jQuery like so:

jQuery(function($){
    $('#myid').[...]
});

or

jQuery('#myid').[...]

But now, I can't get rid of the following error (without calling anything):

Uncaught TypeError: proto.plugins[i].push is not a function

and comes from the jquery-ui.js file with this part:

$.ui.plugin = {
    add: function( module, option, set ) {
        var i,
            proto = $.ui[ module ].prototype;
        for ( i in set ) {
            proto.plugins[ i ] = proto.plugins[ i ] || []; // Error fires here
            proto.plugins[ i ].push( [ option, set[ i ] ] );
        }
    },

Is there a solution?

AnomalySmith
  • 597
  • 2
  • 5
  • 16

1 Answers1

2

I ran into the same problem. The cause for me was my attempt to add a function to javascript's Object class. In fact, simply extending javascript's Object is not supported at all by jQuery - and thereby its plugins.
This answer to the question of extending Object has a good solution which solved the problem with jQueryUI for me.

Community
  • 1
  • 1
Guy Passy
  • 694
  • 1
  • 9
  • 32