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

218
Visualizações
Using the onclick function for a button and the button content (words) show up but the button is not clickable. Any advice?

Just doing some practice and I cannot seem to get this button to function. I have checked multiple sites and seem to be formatting it right. Everything else in my code works properly.

Here is the code:

    <html>
    <head>
        <title>This is a picoCTF JS Example</title>
        <script>
            function myFunctionSum(){
                var number1 = document.getElementById("number1").value;
                var number2 = document.getElementById("number2").value
                car result = number(number1) + Number(number2);
                alert(result);
            }
        </script>
    </head>
    <body>
        <h1>JavaScript example to add2 numbers</h1>
        Input the first number<br>
        <input type="text" id="number1" ><br>
        Input the second number<br>
        <input type="text" id="number2"
        <button onclick="myFunctionSum()"> Show alert! </button>
    </body>
</html>

It is the button portion that seems to not be working. Appreciate all the help.

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

0

car result = number(number1) + Number(number2); its wrong

try this

var result= +number1  +  +number2  ;
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