Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda