10
Reply

What is the difference between size and length of jQuery?

    Size and length both returns the number of element in an object. But length is faster than the size because length is a property and size is a method.

    Agree with Mr. Nitin.In addition you can test from here : http://jsperf.com/size-vs-length

    jQuery .size() method returns number of element in the object. But it is not preferred to use the size()method as jQuery provide .length property and which does the same thing. But the .length property is preferred because it does not have the overhead of a function call

    jQuery .size() and .length both return the number of elements in the jQuery object.Size() and length in jQuery both returns the number of element in an object but length is faster than the size because length is a property and size is a method and length property does not have the overhead of a function call.

    jQuery .size() and .length both return the number of elements in the jQuery object.Size() and length in jQuery both returns the number of element in an object but length is faster than the size because length is a property and size is a method and length property does not have the overhead of a function call.

    jQuery .size() and .length both return the number of elements in the jQuery object.Size() and length in jQuery both returns the number of element in an object but length is faster than the size because length is a property and size is a method and length property does not have the overhead of a function call.source: http://www.namasteui.com/difference-between-size-and-length-of-jquery/

    Both size and length return number of character but compare to size, length is fast beacuse size is method and length is property.

    Size and length both returns the number of element in an object. But length is faster than the size because length is a property and size is a method.

    http://stackoverflow.com/questions/2738352/jquery-size-method-vs-length-attribute

    Size is a method in jquery . It returns number of element in Jquery object. Both size and length return number of element. Size is a method and length is a property so length preferred over size to avoid method call overhead. for Example

    • A
    • B
    alert( "Size: " + $( "li" ).size() ); Result : Size:2alert( "Size: " + $( "li" ).length ); Result Size: 2