Jquery 获取生成的HTML容器内容长度

Jquery 获取生成的HTML容器内容长度,jquery,html,Jquery,Html,我试图获取动态接收HTML数据的HTML容器内容长度。但它不起作用,我得到了目标 <script> $(document).ready(function (e) { var adsense_box_len = $('.container').on('ready', '.adsense-box', function(e) { return $(this)[0].length(); });

我试图获取动态接收HTML数据的HTML容器内容长度。但它不起作用,我得到了目标

<script>
    $(document).ready(function (e) {
            var adsense_box_len = $('.container').on('ready', '.adsense-box', function(e) {
                return $(this)[0].length();
            });
            console.log(adsense_box_len);
        });
</script>
<script>
    $(document).ready(function(e) {
            $('.adsense-box').html('This is html dynamic generated');
        });
</script>

$(文档).ready(函数(e){
var adsense_box_len=$('.container').on('ready','.adsense box',函数(e){
返回$(this)[0].length();
});
控制台日志(adsense\u box\u len);
});
$(文档).ready(函数(e){
$('.adsense box').html('这是动态生成的html');
});

不完全清楚您的用例是什么,但没有元素的就绪事件,只有少数元素,如


对于Jquery 1.11的版本,可以看到它仍然在发送
n.fn.init[div.container,prevObject:n.fn.init(1),context:document,selector:“.container”]
这是一个Jquery对象,您再次尝试从该对象错误地获取内容