$("#main .primary")
.width($(this).closest("#main .row")
.outerWidth(true) - $(this).closest("#main .secondary")
.outerWidth(true));
..doesn’t work at all.
What I’m doing is applying the width to the primary div by subtracting the width of secondary from main (parent).
<div id="main">
<div class="row">
<div class="primary"></div>
<div class="secondary"></div>
</div>
</div>
Thanks
First the selector
#main .rowwill return an empty jQuery Object,if you want to match the element having an id and a class together you can use it like this :
I suggest for you to use the siblings() method in your case