How do I set the inner div's height to it's parent using the each() method?
<div class="box">
<div class="inner">Stuff</div>
</div>
<div class="box">
<div class="inner">Stuff</div>
</div>
<div class="box">
<div class="inner">Stuff</div>
</div>
<div class="box">
<div class="inner">Stuff</div>
</div>
This doesn't seem to work:
$('.box').each(function(){
var $this = $(this);
var $inner = $this.find(".inner");
$inner.height( $this.height );
});
To get element's height you have to use method height():
$('.box').each(function(){
var $this = $(this);
var $inner = $this.find(".inner");
$inner.height( $this.height() );
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With