0
why it's showing cannot set textContent = null
my code is document.getElementById('score-0').textContent = 0; document.getElementById('score-1').textContent = 0; document.getElementById('current-0').textContent = 0; document.getElementById('current-1').textContent = 0; document.getElementById('name-0').textContent = 'Player 1' document.getElementById('name-1').textContent = 'Player 2' document.querySelector('.player-0-panel').classList.remove ('winner'); document.querySelector('.player-1-panel').classList.remove ('winner'); }
2 ответов
+ 5
Two reasons getElementById fails are:
1. DOM isn't ready, use window.onload() or jQuery 'ready' pattern
2. id's aren't set properly
A CodePlayground link would help people be more specific for your case.
0
so what's the solution to do it without a framework.