jQuery size() method vs length attribute

后端 未结 9 2220
天命终不由人
天命终不由人 2020-12-05 22:20

Is there any difference between $(\".selector\").size() and $(\".selector\").length ?

9条回答
  •  天命终不由人
    2020-12-05 23:12

    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.

提交回复
热议问题