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
The Select case feature in Jquery does not work

I am creating a game that is supposed to help me and learn somethings, but I have run into a problem which I can figure out. The problem is that I have created a select tag and they need to select the speed they want, but when they click it, the selection does not work. It returns 50 once then it returns 500 I don't not know why, I have aa excerpt of my game below and under that is the full code, Please check them both out thank you.

Excerpt from the Game:

$(document).ready(function() {

  let NewSpeed = $("#Selection option:selected").val();
  // console.log(NewSpeed)
  $("input").click(function() {
    let TimeSpeed;
    console.log("This Part Excuts")

    switch (NewSpeed) {
      case (NewSpeed = 100):
        TimeSpeed = 100;
        break;
      case (NewSpeed = 300):
        TimeSpeed = 300;
        break;
      case (NewSpeed = 500):
        TimeSpeed = 500;
        break;
      default:
        TimeSpeed = 50;
        break;
    }

    console.log(TimeSpeed)
  })

})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>

<head>
</head>

<body>
  <form action="#">
    <select id="Selection">
      <option value="50">50</option>
      <option value="100">100</option>
      <option value="300">300</option>
      <option value="500">500</option>
    </select>
  </form>

  <input type="button" name="btn" id="btn" value="Click Me" />

</body>

</html>

Full Version: https://codepen.io/Giannilmgc/pen/JjrgZdr

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