Jquery - How to find an element using class and attribute

前端 未结 1 2010
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)
提交回复
热议问题