How can I select item with class within a DIV?

前端 未结 5 1954
遥遥无期
遥遥无期 2020-12-07 10:30

I have the following HTML:

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 11:07

    If you want to select every element that has class attribute "myclass" use

    $('#mydiv .myclass');
    

    If you want to select only div elements that has class attribute "myclass" use

    $("div#mydiv div.myclass");
    

    find more about jquery selectors refer these articles

提交回复
热议问题