jquery, selector for class within id

前端 未结 5 1357
谎友^
谎友^ 2020-12-23 14:20

Below, how should I select the elements that contain the class my_class within the element with id = \"my_id\"?

Note that the element may

5条回答
  •  失恋的感觉
    2020-12-23 14:42

    I think your asking to select only hello this element, You have do like this, If I am understand your question correctly this is the answer,

    $("#my_id [class='my_class']").addClass('test');
    

    DEMO

提交回复
热议问题