I have the following image tag
<img class="someclass" src="somesrc" width="220" height="165" />
The browser is displaying the image with its original width and height which is 480x360
I want to get the image width and height attributes from the image tag which should return 220 and 165
I have tried the following
var img = document.getElementsByClassName('someclass');
console.log(img.clientWidth);
console.log($('.someclass').attr('width'));
But it returns me undefined
.
The following code returns me the actual width and height of the image. which is 480
$('.someclass').width();
Is there any way that it should return the 220 and 165
?