get the elements number inside parent div jquery
问题 I have a div that contain many images: <div id="#preview_images_gallery"> <img class="image_url pager" src="image1.jpg"> <img class="image_url pager" src="image2.jpg"> <img class="image_url pager" src="image3.jpg"> . . . </div> how I can know the number of images contained in this div with jquery? 回答1: $("#preview_images_gallery > img").size() on second thoughts $("#preview_images_gallery > img").length 回答2: $('#preview_images_gallery > img').length 回答3: var imagecount = $('#preview_images