Uncaught TypeError: $(...).size is not a function

Uncaught TypeError: $(...).size is not a function

  1. Blog
  2. 15 November 2026
  3. 2 min read

Stefan Bogdanescu

Founder & Senior Architect

Uncaught TypeError: $(...).size() is not a function

You are seeing Uncaught TypeError: $(...).size is not a function because you are using jQuery 3.x syntax on code written for jQuery 1.x or 2.x. In versions of jQuery prior to 3.0, the .size() method was available as a legacy alias for .length. However, starting with jQuery 3.0, the core team deprecated .size() and removed it entirely from the main namespace in favor of .length or the native length property on jQuery objects.

Your environment is running jQuery 3.2.1, which strictly follows this modern behavior. When your script attempts to execute $('#tick').size(), the engine looks for a method named size on the jQuery object prototype. Since that method no longer exists in version 3.2.1, the runtime throws a TypeError.

Why .length is the correct approach

In modern jQuery, every jQuery object has a numeric property called length that represents the number of DOM elements matched by the selector. This property behaves identically to an array's length.

If you replace the failing code with the native property access, the logic remains exactly the same:

// Old (jQuery 3.x - Fails)
if ($('#tick').size() > 0) { ... }

// New (jQuery 3.x + Legacy 1.x/2.x compatible for most cases)
if ($('#tick').length > 0) { ... }

While you mentioned that replacing it with length didn't resolve the issue in your specific case, this is likely due to other instances of the deprecated method remaining in your codebase. The error stack trace points to multiple functions being called. You need to audit the entire file for every occurrence of .size().

Auditing the Codebase

Reviewing the provided EditExtra.php source material reveals a significant amount of jQuery manipulation logic. While this specific snippet does not explicitly contain .size() calls in the text provided, it is common in older CMS plugins or themes to have multiple instances scattered across different files (e.g., load.php, imagebrowser.php).

The error stack trace indicates the crash happens inside addImage at line 564 of /site/dashboard/load.php. It is highly probable that load.php contains legacy code similar to:

// Suspect Pattern A: Counting elements
var count = $('#some-selector').size(); 

// Suspect Pattern B: Checking existence
if ($('#tick').size() > 0) { ... }

To fix this systematically, you should search your installation for the string .size(. Replace every instance with .length.

Handling jQuery Version Conflicts

If you are maintaining a

Our network