clientWidth y clientHeight devuelve 0 [duplicado]

Esta pregunta ya tiene una respuesta aquí:

jquery .ready y altura del elemento 1 respuesta

¿Por qué clientWidth / Height devuelve 0 en IE, Chrome y Safari? pero en Firefox y Opera funciona bien. Usé este código:

$(document).ready(function () {

    var imgs = document.getElementsByTagName('img');
    var imgLength = imgs.length;

    for (var i = 0; i <= imgLength - 1; i++) {

        var imgWidth = imgs[i].clientWidth;
        var imgHeight = imgs[i].clientHeight;

        $('img').eq(i).attr({
            width: imgWidth,
            height: imgHeight
        });

        console.log(imgWidth);
    }

    console.log(imgLength);

});

¿alguna idea? Gracias

Intenté con window.load con clientwidth, funciona bien para Firefox, Chrome y Opera, pero él no

Respuestas a la pregunta(3)

Su respuesta a la pregunta