TypeError: $(...).parents(...).size is not a function

size() was deprecated years ago and removed in version 3 ... use length instead

if (e.target.id == "wrapper" || $(e.target).parents("#wrapper").length)

All you had to do was look this up in the size() docs to find this out


Please use 'length' like @charlietfl suggested. But I was unable to trace from where the error was getting displayed, hence I ended up with below.

(function ($) {
    $.fn.extend({
        size: function () {
            return $(this).length;
        }
    });
})(jQuery);