Is there a way to dynamically apply style properties, such as 'float', to the parent div
based on its child div
element, preferably using JavaScript without the need for additional div elements?
<div class="chat-message">
<span class="chat-message-me">xxx</span>
<span class="chat-message-content">hiyyy</span>
</div>
<div class="chat-message">
<span class="chat-message-them">01:25 me: </span>
<span class="chat-message-content">hi</span>
</div>
For example, in this code sample, the parent divs are identical but the child divs have different classes. Is it possible to align the parent divs based on their child elements?
I assume an 'if' statement would be necessary for this, but I am having trouble implementing it...
Your assistance is greatly appreciated!
Thank you!