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

145
Visualizações
Uncaught ReferenceError in External JS

I am not sure why I am getting this error: Uncaught ReferenceError: test is not defined. Can anybody please help me figure this out?

Here is my code for html first. I can't see where the problem is. I am not sure what the browsers (Edge and Chrome) are talking about. <canvas id="test"> Your browser does not support the canvas tag. </canvas>

<script>testCanvas(); </script>

Here is my code from my external JS file:

document.addEventListener('DOMContentLoaded',test, false); function testCanvas() { var canvas = document.getElementById("test"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "#FBBE00"; ctx.fillRect(0, 0, 150, 75); }

I have searched high and low by do a lot of research on the internet and consulting my JS books but can't seem to figure out the problem. I even looked for similar problems here on Stack Overflow but they just refer to JQuery. I really need some guidance on this problem. Thank you in advance.

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