Jquery - How to find an element using class and attribute

前端 未结 1 2013
Happy的楠姐
Happy的楠姐 2020-12-29 02:56

I am trying to figure out the most efficient way to find my element. Following i smy structure:

1条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-29 03:24

    Remove the space:

    $("div.a[customattrib='2']")
    

    By putting in the space, you're making it into a descendant selector which finds all elements that match [customattrib='2'] and are inside an element that matches div.a.

    0 讨论(0)
提交回复
热议问题