Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 809 Bytes

no-fn-size.md

File metadata and controls

27 lines (18 loc) · 809 Bytes

jQuery.fn.size() is deprecated, use the .length property instead

The .size() method returns the number of elements in the current jQuery object, but duplicates the more-efficient .length property which provides the same functionality. As of jQuery 1.9 the .length property is the preferred way to retrieve this value.

Solution: Replace any use of .size() with .length.

Rule Details

Examples of incorrect code for this rule:

$('.foo').size()

Examples of correct code for this rule:

$('.foo').length

Further Reading