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

105
Vistas
not redirecting to other page using jQuery

I'm quite new to jQuery and html, looked through google and these forums to no avail.

This is my HTML Code

<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>

And this is my jQuery line that I think should redirect me to another page

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

but it is doing nothing, am I doing something wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Your code (in JS) should be:

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

The return statement there is unnecesary. The e parameter in the click function represents the Event object. Since you're overriding the form's submit action (not sure why), you need that first line to stop the default action.

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