It is now important for google to add explicit width and height on image, Now I have to add this manually on all my client sites, is there any way to add these attr on all images with JS/Jquery ? And pass the google pagespeed test.
I have tried using this code, its adding the attr but this doesnt remove the flag.
$(document).ready(function(){
$('img').each(function(idx, img) {
$(this).attr({
width: img.naturalWidth,
height: img.naturalHeight
})
});
});