I am trying to add width and height attributes to my images; the jQuery I used works in the console but not in the linked .js file. I have tried this and it doesn't work.

```
$(document).ready(function () {
    $('.media-box-image').each(function () {

        var $width = $('.media-box-image').width();
        var $height = $('.media-box-image').height();
        var $this = $(this).find('img');

        $this.attr('width', $width);
        $this.attr('height', $height);
    });
});

```

I also tried this but it also didn't work

```
$(document).ready(function () {
    $('.media-box-image').each().on('load', function () {

        var $width = $('.media-box-image').width();
        var $height = $('.media-box-image').height();
        var $this = $(this).find('img');

        $this.attr('width', $width);
        $this.attr('height', $height);
    });
});

```

I checked the console but everything seems to be fine. What else can I do?