jQuery closest exclude self

You can traverse a level up before trying to find the .closest() ancestor:

$(this).parent().closest('.container');

Vanilla js:

el.parentElement.closest('.container')

Jquery:

el.parent().closest('.container');