Is there any difference between $(\".selector\").size()
and $(\".selector\").length
?
They will both give you the same result but .length is slightly faster.
See http://api.jquery.com/size/:
The .length property is a slightly faster way to get this information.
No. size()
returns length
. By using length
you only avoid one extra method call.
Length returns the same thing and is slightly faster according to the jQuery documentation.
Source: http://api.jquery.com/size/