You could do something like:
var c = $(".classA").filter(function() {
return !$(this).hasClass("ClassB");
})
This will return those elements that don't have ClassB
If you want to get all the Elements that has both classes, just remove the !
from !$(this)
Demo
var c = $(".classA").filter(function() {
return !$(this).hasClass("ClassB");
})
console.log(c)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="classA ClassB"></div>
<div class="classA ClassB"></div>
<div class="classA ClassB"></div>
<div class="classA"></div>
<div class="classA ClassB"></div>