closest() will get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. But I want
If you truly want only parent divs, then yes $(this).parents('.container') would work. If you want to look for the closest element and allow for it to be a sibling (which it seems might be what you are actually trying to accomplish) you can use $(this).prev('.container').