0

I'm getting this error:

uncaught TypeError: Object [object Object] has no method 'on' 

at jquery.handsontable.js:2258

I've got something setup that looks like this:

<script src="/javascripts/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui-1.8.12.custom.min.js" type="text/javascript"></script>
<script src="/javascripts/jquery.handsontable.js" type="text/javascript"></script>
<script src="/javascripts/jquery.simplemodal.1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
    var $j = jQuery.noConflict();
</script>

<div id="dataTable" class="dataTable"></div>
<script>
$j("#dataTable").handsontable();
var data = [
        ["", "Kia", "Nissan", "Toyota", "Honda"],
        ["2008", 10, 11, 12, 13],
        ["2009", 20, 11, 14, 13],
        ["2010", 30, 15, 12, 13]
];
$j("#dataTable").handsontable("loadData", data);
</script>
i.am.michiel
  • 10,281
  • 7
  • 50
  • 86
bdeonovic
  • 4,130
  • 7
  • 40
  • 70
  • if you have a new question that you need help on, please use the [Ask Question](http://stackoverflow.com/questions/ask) link. – George Stocker Jun 25 '12 at 15:34

2 Answers2

5

You probably need jQuery 1.7

jQuery 1.5 has no .on method. It was introduced to replace .live() and provide a more consistent interface for regular vs delegated event handling.

Note that if you make extensive use of .attr() you may need to modify your code to use .prop() in some places instead - jQuery 1.6 introduced major changes to the way .attr() works.

Alnitak
  • 334,560
  • 70
  • 407
  • 495
2

The handsontable plugin requires jQuery 1.9+ due to the use of .on and other methods not available in older versions of jQuery.

You could create a small script that implements .on to use .bind and .delegate where appropriate.

Kevin B
  • 94,570
  • 16
  • 163
  • 180