I want to select all the elements that have the two classes a and b.
So, only the e
The problem you're having, is that you are using a Group Selector, whereas you should be using a Multiples selector! To be more specific, you're using $('.a, .b') whereas you should be using $('.a.b').
For more information, see the overview of the different ways to combine selectors herebelow!
Select all elements AND all elements AND all elements :
$('h1, p, a')
Select all elements of type text, with classes code and red :
$('input[type="text"].code.red')
Select all elements inside elements:
$('p i')
Select all elements that are immediate children of a element:
$('li > ul')
Select all elements that are placed immediately after elements:
$('h2 + a')
Select all elements that are siblings of $('div ~ span')