Compare ‘e.target’ to a jQuery object
To check if e.target has this class you can use the hasClass function. if ($(e.target).hasClass(“selector”)) Or, if you really want to compare objects, note that jQuery selectors return a collection of items, so I think you’ll want if (e.target === $(‘.selector’)[0])