Show Div when other div is visible (no Jquery) [closed]

Right now I am using Jquery to show a div when a other Div from a result (after search) is visible. The results create a div with all ID’s
div id1, id2, id3 and so on.

I use this code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>        
<script>
    $("#Div5").is(":visible")&&$("#Div3").after('<div class="between">tekst</div>'),
    $("#Div6").is(":visible")&&$("#Div5").after('<div class="between">tekst</div>');
</script>

Right now, I think this is hurting my performance, Loading a full Jquery, just for this small code. i am not using Jquery anywhere else on the website.

Is there a better way to get the same results, but without having to load the full jquery. The goal is to only show a extra div if the search results have more then 5 outcomes(divs) and/ or more then 6. So if the search only gives back 3 results, then no divs need to be shown extra.