"use strict" causes the error $this is undefined
Hi,
The code bellow works without "use strict" but when I add "use strict" to it, it shows an error saying "Uncaught TypeError".
- (function ($) {
- "use strict";
- $('.field-widget-file-generic').each(function () {
- $this = $(this);
- if(!$this.find('.table-striped').length && $this.find('.file-widget span.file').length) {
- $this.find('.file-widget span.file').closest('.file-widget').addClass('only-one-file');
- }
- });
- })(jQuery);
I need to use "use strict" but I don't know how to fix the code to get rid of the error.
Thanks