Sorry for the noob question as I just picked up javascript today.
I'm trying to create and delete div's with javascript buttons, and I have that working fairly well.
However when I delete,for example, div #7, out of div 1-8 I need the text to change so that it doesn't look like
number: 1
number: 2
number: 3
number: 4
number: 5
number: 6
number: 8
This code adds the div at the end of the containing div xbox
d1.insertAdjacentHTML('beforeend', '<div class="xbox" id ="xbox1'+numItems+'">Number: '+countBox()+'</div>
this code counts the amount of boxes already
function countBox()
{
var numItems = $('.Cbox').length;
return numItems;
}
I've thought about just taking the div and setting the inner-html. But I figured I'd see if there is a better way to force the code to update the variable.