Jquery - How to find an element using class and attribute
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
.