0

.each() 関数内で要素の幅を取得しようとしていますが、単に機能しないという問題が発生しています。

jQuery(document).ready(function($) {
    $('.tooltip').each(function() {
        var self = $(this);

        var width = self.find("#testing").offsetWidth;
        alert(width); //Returns undefined

        $(this).find(".tooltip-icon").hover(function(){
            self.find(".tooltip-text").show();
        }, function () {
            self.find(".tooltip-text").hide();
        });
    });
});
4

1 に答える 1