How to select all elements with particular ARIA value using jQuery?

前端 未结 2 797
面向向阳花
面向向阳花 2021-01-07 19:35

Given i have a sample page that looks like this:





heading

2条回答
  •  感动是毒
    2021-01-07 20:10

    Use something like this -

    WORKING DEMO

    var elements = $("body").find("[aria-controls='name1']");
    

    Above is for if you want to look for elements within a container eg body in this case, it can be some div also.

    --OR--

    var elements = $("[aria-controls='name1']"); 
    

    Above is for if you want to get all the elements with this attribute

提交回复
热议问题