JQuery Autosize plugin error - intermediate value (...) is not a function

I am using jQuery Autosize plugin:

http://www.jacklmoore.com/autosize/

script 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 working:

 "TypeError: (intermediate value)(...) is not a function" 

The Javascript console reports this error in the last line of the script:

 }(window.jQuery || window.$)); 

Problem N 2

Script does not work in modal windows (PrettyPhoto), and the javascript console does not show any errors.

Any ideas?

+43
jquery autogrow
Apr 29 '14 at 16:29
source share
3 answers

"TypeError: (intermediate value)(...) is not a function" appears due to the lack of a half-column in the function before it causes an error. It could be that simple:

 jQuery(function($){$(document).ready(function(){ $('textarea').autosize(); } ); //<----- 

or it may be a function declared before that. An example of this in this code:

 var populate = function(sw) { myglobalswitch = sw; window.setTimeout(repopulate, 250, sw); } (function( $ ) { $.widget( "custom.combobox", { _create: function() { .... })( jQuery ); 

results in an intermediate value not ... in the last line: })( jQuery );

However, the fix adds a half-hour to the function being populated:

 var populate = function(sw) { myglobalswitch = sw; window.setTimeout(repopulate, 250, sw); } ; 

so that the browser does not think that "var populate = ..." and (function ($) ... are one operator, the second from the first.

+147
Aug 20 '14 at 18:51
source share

FWIW has changed the autosize call method. If you end here and use it with jQuery

It used to be

 $('textarea').autosize(); 

New challenge

 autosize($('textarea')); 
+5
Aug 12 '15 at 14:25
source share

You may have declared a function inside a function after you need it. That was my problem.

-one
Feb 01 '17 at 21:28
source share



All Articles