The preferred way is to use the css method:
$('#yourImgID').css({ width: '300px', height: '150px' });
If you must specifically add the width and height attributes to the <img> element, replace the css method with the attr method:
$('#yourImgID').attr({ width: '300px', height: '150px' });
solved Add Height and Width through jQuery [closed]