漫长的一天,所以最有可能我失去了一些愚蠢的东西,但我想要做的是循环表获取其宽度,然后设置父元素的宽度,但不工作任何想法或看到哪里出错了?jQuery - 通过表循环,获取宽度和设置父类
HTML
<div class="vScroll">
<table class="table-scroll">
....
</table>
<div class="box-bottom">stuff here</div>
</div>
<div class="vScroll">
<table class="table-scroll">
....
</table>
<div class="box-bottom">stuff here</div>
</div>
<div class="vScroll">
<table class="table-scroll">
....
</table>
<div class="box-bottom">stuff here</div>
</div>
JS
jQuery('.vScroll .table-scroll').each(function(i,el) {
var $tableSize = jQuery(this).width();
jQuery(this).parent('.box-bottom').css('width',$tableSize);
});
提前感谢!
其他.table-scroll? – SarathSprakash
'table-class'应该是'table-scroll'吗? –
抱歉是的,我的错误 –