jQuery Autosize插件错误-中间值(...)不是函数 [英] jQuery Autosize plugin error - intermediate value(...) is not a function
问题描述
我使用jQuery Autosize插件:
http://www.jacklmoore.com/autosize/
您可以在此处看到脚本本身:
http://www.jacklmoore.com/js/jquery.autosize.js >
这是我使用脚本的方式:
jQuery(function($){$(document).ready(function(){
$('textarea').autosize();
}
问题N 1
只需将脚本更新到最新版本,它便停止工作:
"TypeError: (intermediate value)(...) is not a function"
Javascript控制台在脚本的最后一行报告此错误:
}(window.jQuery || window.$));
问题N 2
脚本在模式窗口(PrettyPhoto)中不起作用,并且javascript控制台不显示任何错误.
有什么想法吗?
"TypeError: (intermediate value)(...) is not a function"
由于在函数之前抛出半角冒号而导致错误,因此弹出.它可能很简单:
jQuery(function($){$(document).ready(function(){
$('textarea').autosize();
}
); //<-----
或者它可能是在此之前声明的函数. 此代码中的一个原因示例:
var populate = function(sw) {
myglobalswitch = sw;
window.setTimeout(repopulate, 250, sw);
}
(function( $ ) {
$.widget( "custom.combobox", {
_create: function() {
....
})( jQuery );
最后一行中的中间值不是... :})( jQuery );
但是,此修复程序是在填充函数中添加了分号:
var populate = function(sw) {
myglobalswitch = sw;
window.setTimeout(repopulate, 250, sw);
} ;
防止分析器认为"var populate = ..."和(function($)...是单个语句,第二个语句是从第一个语句开始的.
I use jQuery Autosize plugin:
http://www.jacklmoore.com/autosize/
The script itself you can see here:
http://www.jacklmoore.com/js/jquery.autosize.js
This is how I use the script:
jQuery(function($){$(document).ready(function(){
$('textarea').autosize();
}
Problem N 1
Just updated the script to the latest version and it stopped to work:
"TypeError: (intermediate value)(...) is not a function"
Javascript console reports this error on the last line of the script:
}(window.jQuery || window.$));
Problem N 2
Script doesn't work in modal windows (PrettyPhoto) and javascript console doesn't show any errors.
Any ideas?
the "TypeError: (intermediate value)(...) is not a function"
pops up as the result of missing a semi colon on the function BEFORE the one it throws an error on. It might be as simple as:
jQuery(function($){$(document).ready(function(){
$('textarea').autosize();
}
); //<-----
or it could be the function declared before that. An example of how this is cause is in this code:
var populate = function(sw) {
myglobalswitch = sw;
window.setTimeout(repopulate, 250, sw);
}
(function( $ ) {
$.widget( "custom.combobox", {
_create: function() {
....
})( jQuery );
results in the Intermediate value is not... on the last line: })( jQuery );
However, the fix is adding a semi colon to the populate function:
var populate = function(sw) {
myglobalswitch = sw;
window.setTimeout(repopulate, 250, sw);
} ;
to prevent the parser from thinking that "var populate = ... " and (function($) ... are a single statement, the second extending from the first.
这篇关于jQuery Autosize插件错误-中间值(...)不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!