Count number of img tags inside a div tag

前端 未结 10 1969
暗喜
暗喜 2021-02-04 05:29

My code goes like this.

10条回答
  •  离开以前
    2021-02-04 05:48

    Count img inside #some_div:

     $("#some_id img").length
    

    If you want only the direct children, not all descendants:

    $("#some_id > img").length
    

提交回复
热议问题