Copy the code code as follows: var totalPanels = $(".scrollContainer").children().size(); alert(totalPanels) results in 2 accumulation