I’m trying to write some code that will print out the dimensions of all images contained in a div, simple as it seems I can’t get it working. Could anyone point out the errors here?
Thanks!
$(document).ready(function() {
var width = 0;
var height = 0;
var hello = "hello";
$('#imagebox img').each(function(){
width = $(this).width;
height = $(this).height;
$('#main').append(hello);
$('#main').append(width);
$('#main').append(height);
});
});
width and height are functions. Try: