Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
Convert JS to autoload

Currently I use

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>   
<script type="text/javascript">
$(document).ready(function(){
    $("button").click(function(){
    $("#output").load("https://somesite.com/Search.html");
    });
});
</script>
<body>
    <div class="formClass">
        <div id="output">
        </div>
        <button type="button">Search</button>
    </div>

to implement an offsite html into my current page. Howevee this way, the visitor is required to press the "Search" button to reveal the content.

Is there a way to 'automatically' load this, without user interaction ? (I know a way to trigger the button at siteload, but I'd rather have the button not be there in the first place)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Move the load call out of the click event listener:

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>   
<script type="text/javascript">
$(document).ready(function(){
    $("#output").load("https://somesite.com/Search.html");
});
</script>
<body>
    <div class="formClass">
        <div id="output">
        </div>
        <button type="button">Search</button>
    </div>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda