Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获类型错误:对象[对象对象]没有方法';可手持';?_Javascript_Jquery_Handsontable - Fatal编程技术网

Javascript 未捕获类型错误:对象[对象对象]没有方法';可手持';?

Javascript 未捕获类型错误:对象[对象对象]没有方法';可手持';?,javascript,jquery,handsontable,Javascript,Jquery,Handsontable,我正在使用插件实现类似excel的表格。我的问题有点奇怪。在我的javascript代码中,我在document.ready事件中的div元素上调用此插件,如: $("#vdcontainer").handsontable({ startRows: 2, startCols: 1, colHeaders: ["<span style='font-size:15px; font-weight:bolder; width:500px; text

我正在使用插件实现类似excel的表格。我的问题有点奇怪。在我的javascript代码中,我在document.ready事件中的div元素上调用此插件,如:

 $("#vdcontainer").handsontable({
        startRows: 2,
        startCols: 1,
        colHeaders: ["<span style='font-size:15px; font-weight:bolder; width:500px; text-align:center;'>Enter variable data here Or just cut & paste</span>"],
        minSpareRows: 1
    });
现在它在控制台上显示以下错误消息

Uncaught TypeError: Object [object Object] has no method 'handsontable' 

有人知道为什么对handsontable函数的调用在document.ready事件上运行良好,而在同一个js文件中的事件处理程序函数中不工作吗?

您包含的jQuery版本可能太旧了-由于使用了.on,handsontable插件需要jQuery 1.7+。

您是否包含
handsontable
文件?是的,我包含了它,这就是它在document中工作的原因。readyIt最初似乎工作,因为它在div中创建了类似excel的表。只有在从事件处理程序函数内部调用它时才会发生错误。另外:您确定没有意外地包含jQuery两次吗?(第二次是在运行
.ready()
处理程序之后,但在单击“处理程序执行”之前。)在这种情况下,jQuery的第二个“实例”不会初始化插件。您可以制作一个小提琴来显示问题,或者提供指向您的站点的问题链接吗?
Uncaught TypeError: Object [object Object] has no method 'handsontable'