How to get img inside a particular div using JQuery

前端 未结 4 1959
温柔的废话
温柔的废话 2021-02-05 09:27

I have to get all the image tags ids inside a particular div. How can I get that using JQuery?

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 09:49

    Use a child selector. So your saying I want all of the child 'img' elements of div #myDiv

    $("#myDiv > img").css("border", "3px double red");
    

    http://api.jquery.com/child-selector/

提交回复
热议问题