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

103
Views
onsubmit doesn't display text

Pressing the submit button doesn't display my text, but the values show up in a new url. How can I fix this? I've tried the same thing before with a different form style which worked, but I needed a new style for alignment...

var passes = document.getElementById("passes").value.toString();
var slots = document.getElementById("slots").value.toString();

function showInput() {
  document.getElementById("display-input").innerHTML =
    "You entered " + passes + " for the number of passes.\n" +
    "You entered " + slots + " for the number of passes.";
  return false;
}
<div class="form">
  <form name="form" id="form" onsubmit="showInput(); return false;">
    <table>
      <tr>
        <td>Passes: </td>
        <td><input type="number" name="passes" id="passes" /></td>
      </tr>
      <tr>
        <td>Slots: </td>
        <td><input type="number" name="slots" id="slots" /></td>
      </tr>
      <tr>
        <td></td>
        <td><input type="submit" value="Submit" /></td>
      </tr>
    </table>
  </form>
</div>
<p><span id="display-input"></span></p>

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