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

180
Vistas
Javascript password + button open URL in targeted element

I learned how to open a link using a password and button. I used the following code:

<input type="text" id="text" />
<input type="button" id="btn" value="Submit" onClick="window.location=url;" />

<script>
$("#btn").click(function() {
window.location="example.com/"+$("#text").val();})
</script>

What I would like to figure out is whether I can target a div element for the link to open within.

I've been using the following script to load html pages into a specified div element with a link:

<div class="item1" id="pageone"></div>
<a href="" onclick="loadSAMEDiv1(); return false;">link</a>

<script>
function loadSAMEDiv1() { 
$.ajax({ 
 url: 'item1.html', 
 success: function(data) { 
      $('#pageone').html(data); 
 } 
 }); 
} 
</script>

I guess I'm wondering if there's a way to make the password url made by the first script open in a targeted div, like it does in the second script. So when you click the button element it will make the url using the password entered into the text box and load it into a div like #pageone.

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

0

The simplest way to do this is with Ajax load(). Try this.

<input type="text" id="text" />
<input type="button" id="btn" value="Submit"/>

<div class="item1" id="pageone"></div>

<script>
    $("#btn").on("click", function() {
        $("#pageone").load("example.com/"+$("#text").val());
    });
</script>
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