Reputation: 3
Hi how to update the count of to do items
<span>Item count: <span id="item-count">0</span></span>
function updateCount() {
const count = list.childElementCount;
}
Upvotes: 0
Views: 277
Reputation: 403
$('#main-div .specific-class').length
source: How can I count the number of elements with same class?
Upvotes: 0
Reputation: 15847
You can use innerHTML, innerText or textContent;
var counter = document.querySelector("#item-count");
counter.innerHTML = 0;
or
var counter = document.querySelector("#item-count");
counter.innerText = 0;
or
var counter = document.querySelector("#item-count");
counter.textContent = 0;
Upvotes: 1