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

99
Views
no redirigir a otra página usando jQuery

Soy bastante nuevo en jQuery y html, busqué en Google y estos foros sin éxito.

Este es mi código HTML

 <html> <head> <link rel="stylesheet" href="reset.css" type="text/css"> <link rel="stylesheet" href="index.css" type="text/css"> <script src="./jquery.js" type="text/javascript"></script> </head> <body> <div id="container"> <form id="form"> <h1>Koks yra leistingas greitis miesto ribose?</h1> <input type="radio", id="ats1", name="atsakymas", value="1" ></input> <label for="ats1"> a</label> <br> <input type="radio", id="ats2", name="atsakymas", value="2" ></input> <label for="ats2"> b</label> <br> <input type="radio", id="ats3", name="atsakymas", value="3" ></input> <label for="ats3"> c</label> <br> <button id="Rinktis" type="submit">Rinktis</button> <button id="close">Išeiti</button> </form> </div> <script src="./index.js" type="text/javascript"></script> </body>

Y esta es mi línea de jQuery que creo que debería redirigirme a otra página

 $("#Rinktis").click(function (){ document.location.href = "http://google.com"; return; })

pero no hace nada, estoy haciendo algo mal?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su código (en JS) debe ser:

 $("#Rinktis").click(function (e) { e.preventDefault(); window.location.href = "http://www.google.com"; })

La declaración de devolución allí es innecesaria. El parámetro e en la función de clic representa el objeto Evento . Dado que está anulando la acción de envío del formulario (no estoy seguro de por qué), necesita esa primera línea para detener la acción predeterminada.

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!