what’s wrong with this javascript script.?

Your blanking out everything inside .resultParas.. And this will include all you <p> tags. IOW: after doing that they have disappeared from the DOM, you can see this say in chrome inspector that .resultPara’s after clicking reset game is now blank, and all your p tags have gone.

I think what you really want to do, is blank out the children (the p tags)..

You don’t need querySelectorAll either, as in your case there is only the one.

var resetParas = document.querySelector('.resultParas');
for(var i = 0 ; i < resetParas.children.length ; i++) {
  resetParas.children[i].textContent="";
}

Leave a Comment