Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 获取表高度返回的负值_Jquery_Html - Fatal编程技术网

Jquery 获取表高度返回的负值

Jquery 获取表高度返回的负值,jquery,html,Jquery,Html,但是当我用上面的代码得到表的高度时,它总是返回-2。如何获取每个表的实际值(类名为.tbl each),您可以试试这个。这对我来说太棒了 $(文档).ready(函数(){ $(“#checkfeedhide”).children().find('.tbl each').each(函数(索引,val){ var height=$(this.height(); 控制台日志(高度+''+索引); }); }); 用户注册PHP&MYSQL table.table.table-bordered.t

但是当我用上面的代码得到表的高度时,它总是返回
-2
。如何获取每个表的实际值(类名为
.tbl each

),您可以试试这个。这对我来说太棒了

$(文档).ready(函数(){
$(“#checkfeedhide”).children().find('.tbl each').each(函数(索引,val){
var height=$(this.height();
控制台日志(高度+''+索引);
});
});

用户注册PHP&MYSQL
table.table.table-bordered.tbl-each{
边框:1px纯黑;
}
...

第一张表

名字 姓氏 年龄 吉尔 史密斯 50

第二张表

名字 姓氏 年龄 吉尔 史密斯 50 前夕 杰克逊 94

第三张表

名字 姓氏 年龄 吉尔 史密斯 50 前夕 杰克逊 94 吉尔 史密斯 50

第四个表

A. B C 10 20 30

第五表

名字 姓氏 年龄 吉尔 史密斯 50 前夕 杰克逊 94 吉尔 史密斯 50 吉尔 史密斯 50

第六表

名字 姓氏 年龄
$(document).ready(函数(){$('.tbl each').each(函数(){console.log($(this.height());}))

...
...
...
...
...
...

问题中的代码不会复制您描述的行为。请编辑您的问题以包含一个。
<div class="tab-pane" id="checkfeedhide">
<div class="row">
    <div class="col-md-6 col-xs-12">
        <fieldset class="schedule-border">
            <div class="row">...</div>
            <div class="row check_list_feed">
                <div class="col-md-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered tbl-each">...</table>
                        <table class="table table-bordered tbl-each">...</table>
                        <table class="table table-bordered tbl-each">...</table>
                        <table class="table table-bordered tbl-each">...</table>
                        <table class="table table-bordered tbl-each">...</table>
                        <table class="table table-bordered tbl-each">...</table>
                    </div>
                </div>
            </div>
        </fieldset>
    </div>
</div>
$(document).ready(function() {
    $("#checkfeedhide").children().find('.tbl-each').each(function(index, val) {

        var height = $(this).height();
        console.log(height+' '+index);
    });
});