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

187
Views
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 answers
Answer question

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