Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!