How to dynamically make one div the same width (or height) as another div with jQuery

Sometimes you want one div to change its width based on the width of another div. If the divs are changing their dimensions based on the browser size, this can be tricky! Here’s a way to do it with jQuery. #div2ID is the div you want to resize, based on the width of #div1ID. The same can be done with div height.

View the code on JSFiddle here.

Leave a Comment