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

186
Visualizações
Why isn't my evaluate function being called on click?

I am new to JS so please bear with me :)

below is the code but on clicking it does not trigger the function

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button type="submit" onclick="evaluate()">Submit</button>
</body>
<script type="text/javascript">
    function evaluate(){
        document.write("Working");
    };
</script>
</html>

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

evaluate() is a reserved function in JavaScript. Name your function something else.

The fact that the console error mentioned the need for two arguments was a clue that the function was defined somewhere already, and that your definition wasn't being considered.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button type="submit" onclick="notEvaluate()">Submit</button>
</body>
<script type="text/javascript">
  function notEvaluate() {
    document.write("Working");
  };
</script>

</html>

Regarding document.write, see Why is document.write considered a "bad practice"?.

about 4 years ago · Juan Pablo Isaza Relatório

0

Try using a function name different than "evaluate" - evaluate is a reserved function name

about 4 years ago · Juan Pablo Isaza Relatório
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