How to understand the length of elements in js

when you look at some plug-in source code, you often see $(document). Find (".dom") .length. Does the length here refer to the number of elements whose class is dom?

Jul.10,2022

$(document) returns a reference to document
$(document). Find ('.dom') returns an array of dom references
$(document). Find ('.dom'). Length is naturally the length of the array


find () method returns the descendant elements of the selected element. $(document). Find ('.dom'). Length refers to the number of elements whose class is dom

Menu