---
title: "Difference between size() and length() method in jQuery?"  
description: "Difference between size() and length() method in jQuery?"  
author: "Ethan Karla"  
published: 2021-07-28  
updated: 2023-11-28  
canonical: https://www.mindstick.com/forum/156641/difference-between-size-and-length-method-in-jquery  
category: "jquery"  
tags: ["jquery"]  
reading_time: 1 minute  

---

# Difference between size() and length() method in jQuery?

What is the [difference](https://www.mindstick.com/articles/157114/good-news-or-bad-news-and-the-difference-is) between [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files)() and [length](https://www.mindstick.com/interview/1915/what-is-the-difference-between-char_length-and-length)() [method in jQuery](https://www.mindstick.com/forum/156655/trim-method-in-jquery)?

## Replies

### Reply by Aryan Kumar

In jQuery, both **size()** and **length** are used to determine the number of elements in a set, but there's a key difference between them.

## size() [method](https://www.mindstick.com/forum/166/webservice-method):

- The **size()** method is used to get the number of elements in the matched set.
- It returns an integer representing the number of elements.

## length property:

- The **length** property is a property of the jQuery object and provides the same functionality as **size()**.
- It directly retrieves the number of elements without the need for a method.

In practice, the **length** property is more commonly used because it's simpler and performs better. Both **size()** and **length** will give you the count of elements in the jQuery object. Choose either based on your preference, but **length** is generally favored for its simplicity and efficiency.


---

Original Source: https://www.mindstick.com/forum/156641/difference-between-size-and-length-method-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
