-1

I get this message:

"Object [object Object] has no method 'on' "

to the code:

$(window).on('resize', function () {
    self.setDimensions();
});

what can I do? I already have jQuery 1.9...

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

2 Answers2

1

Make sure you use at least jQuery version 1.7

Prior to 1.7, you can replace .on() with .bind() (if you're not using event delegation).

The best would probably be for you to upgrade to the lastest jQuery version - 1.9 ATM.

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134
0

If you have included the latest version of jQuery, and it still says there is no on, then that means some other library is overwriting $. To solve this issue, try this:

$.noConflict();
jQuery(document).ready(function($) {
    // Use $ here
    var self = mysterious();
    $(window).on("resize", function(){
        self.setDimensions();
    })
});

http://jsfiddle.net/DerekL/SUBGD/

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247