Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

86
Visualizações
want to change the values of html table cell using javascript using eventlistner

I want to make a tic tac toe game , trying to grab all the td using querySelectorAll and and by using eventlistner i am trying to manipulate the 'td' but its showing error

here is html code:

<body>
    <h1> Welcome to tic tac toe game </h1>
    <button onclick="history.go(0)"> Restart </button>
    <table border="1"  align="center" >
        <tr> <td> </td>  <td > </td>  <td ></td> </tr>
        <tr> <td> </td>  <td ></td>  <td ></td> </tr>
        <tr> <td> </td>  <td ></td>  <td ></td> </tr>
    </table>

javascript :

 let cell = document.querySelectorAll('td');
cell.addEventListner('click',function(){
    cell.textContent = 'x';  
})

Error : **

tic_toe_game.js:2 Uncaught TypeError: cell.addEventListner is not a function
    at tic_toe_game.js:2:6

**

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda