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

107
Visualizações
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
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