I am trying to add a border for a div but there are other divs inside it towards the end. I want to end the border until a particular div. Sample code is below. Will not be able to edit the actual template so I am looking for a jQuery/CSS solution to solve this. Adding border using specific CSS classes is an option but not a perfect solution as there is going to gap between sections and border will be missing.
$(".article-content")
.css("border", "2px red solid")
.find("#beforeFooter")
.end();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<div class="article-content">
<div class="article-title">Title</div>
<div class="article-share">Share tools</div>
<p><span>Hello</span>, how are you?</p>
<p><span>Hello</span>, your name?</p>
<p><span>Hello</span>, your age?</p>
<p>Ends here</p>
<div id="beforeFooter"><img src="https://via.placeholder.com/600x150" /></div>
<div class="article-footer">Some other footer content</div>
</div>