I have 2 elements with different heights and I want to make them equal:
var highestEl = $('#secondElement').height();
$('.element').first().height(highestEl);
I understand that the second element is always taller than the first one. When both elements contain plain text, everything works smoothly. However, when I add elements with margins or padding to the second element (which is always taller), the calculation breaks down. It considers the height of the taller element but does not factor in the total sum of margins of child elements inside the second element.
How can I accurately calculate the full height of an element including margins/paddings?