I am faced with a situation where I need to identify all elements belonging to a specific class and adjust the padding-bottom of their parent div based on the height of the matched element.
For example, consider the following structure:
<div class='A'>
<div class='B'>
<div class='C'>
.........
</div>
<div class='D'>
.........
</div>
</div>
<div class='B'>
<div class='C'>
.........
</div>
</div>
<div class='B'>
<div class='C'>
.........
</div>
</div>
<div class='B'>
<div class='D'>
....
The goal is to select all instances of D class objects, and then modify the padding-bottom value of their parent container (class B) by adding the height of the D object to its current padding. It's important to note that each D object has a different height, and each B can only contain one D or C Object.
In order to achieve this using jQuery, what specific code do I need?