Currently, I have a div that is dynamically generating elements at the bottom. My goal is to hide these elements regardless of their IDs using javaScript/jQuery. Here's a snippet of my HTML structure:
<div class="right-panel">
<div class="info">Text</div>
<form id="the-form">
<input type="hidden" name="first-name" value="">
<input type="hidden" name="last-name" value="">
<input type="hidden" name="state" value="">
</form>
<script>javaScript</script>
<div id="dynamic-id-1">Advertisement 1</div>
<div id="dynamic-id-2">Advertisement 2</div>
</div>
I am looking for a method to consistently remove or hide the "dynamic-id-1" and "dynamic-id-2" divs without specifying their individual IDs. Is there a way to target these elements based on their position or other attributes?
In my attempts, I experimented with this code but encountered limitations with multiple divs:
$('#the-form').next().hide();
(Please note that these divs do not share a common class, and their IDs are frequently changing. I was hoping to find a unique approach to target and hide the last two divs within the parent div.)