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

171
Visualizações
HTML button doesn't do anything and unexpected code

I made a simple don't press the button game and there are two errors (the other will be in a different question) Unexpected text this is the code I wrote:

<body>
        <h1>Don't press the button</h1><br/>
        <p>DON'T PRESS THE BUTTON</p>
        <div class="round-button">
          <button type="button" onclick="alert('Why Did You Press Me. The next button you click will have consequences')">Don't Click Me</button>
        </div>
        <div class="hint-text">
          <p><b>V V V V</b></p>
        </div>
        <div class="round-button button2">
          <button type="button" onclick="alert('Ok, this is your last chance. Don't press anymore buttons... not that there are any')">NOT A BUTTON</button>
        </div>

and this is the code in the web page:

<body>
        "Don't Press the Button "
        <h1>Don't press the button</h1><br/>
        <p>DON'T PRESS THE BUTTON</p>
        <div class="round-button">
          <button type="button" onclick="alert('Why Did You Press Me. The next button you click will have consequences')">Don't Click Me</button>
        </div>
        <div class="hint-text">
          <p><b>V V V V</b></p>
        </div>
        <div class="round-button button2">
          <button type="button" onclick="alert('Ok, this is your last chance. Don't press anymore buttons... not that there are any')">NOT A BUTTON</button>
        </div>
</body>        

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

0

As @K Scandrett said in their comment, the apostrophe in "Don't" is causing your problem. You need to escape it by putting a "" before, like this:

onclick="alert('Ok, this is your last chance. Don\'t press anymore buttons... not that there are any')">NOT A BUTTON</button>
        </div>
</body> 

Escape characters are used to remove the special meaning from a single character, and instead preserve the literal value. In this case, the quote within "Don't" was causing the program to read that as the end of the string, and ignore the rest of that line. That's why you got this error:

{ "message": "Uncaught SyntaxError: missing ) after argument list", }

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