Due to my limited JavaScript experience, I am struggling with understanding the event flow. This was written in haste, and further editing may be needed.
I am working on creating a stack of cards (Bootstrap cards) along with a load button. To keep it independent of any dependencies, I am using JavaScript.
I'm having trouble grasping the event flow, or I can't seem to hide the load button.
window.onload = testCards;
function testCards() {
var col_num = document.querySelector(".col-6");
if (col_num &< 10) {
var loadBtn = document.querySelectorAll(".d-grid .gap-4");
loadBtn.querySelector(".btn").classList.add("invisible");
}
}
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8be9e4e4fff8fff9eafbcbbea5bba5bba6e9eeffeab9">[email protected]</a>/dist/js/bootstrap.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ef8d80809b9c9b9d8e9fafdac1dfc1dfc28d8a9b8edd">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" />
<h3>Footer card</h3>
<div class "row footer-card">
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
<div class="col-6 card">
<p>This is card</p>
</div>
</div>
<div class="d-grid gap-4">
<button class="btn btn-secondary py-1 my-3 mx-5" type="button">Load More</button>
</div>
How can I hide the "load more" button when the number of cards is less than 10?