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

149
Visualizações
Button onload calls function

I have the following button

<button type="button"
  title="Previous value:"
  ***onload="test()"***
  class="btn btn-warning mb-2" style="padding: 4px 8px 4px 8px; border-radius: 1rem;">
 <i class="fas fa-exclamation-triangle text-white"></i>
</button>

Which I want it when it loads to call the test() function

function test() {
    console.log("I am in");
}

in reality this function will be creating a popover. But it doesnt seem to be calling the function. (No, onclick or hover is not helping me.)

Any suggestions, ideas how to achieve that?

Many thanks in advance.

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

0

onload event is only supported on these HTML tags:

<body> <iframe> <img> <input type="image"> <link> <script> <style>

take a look at: HTML onload attribute

about 4 years ago · Juan Pablo Isaza Relatório

0

    <button type="button" title="Previous value:" onclick="test()" class="btn btn-warning mb-2" style="padding: 4px 8px 4px 8px; border-radius: 1rem;">
 <i class="fas fa-exclamation-triangle text-white"></i>
</button>

<script>

function test(){
    //alert("test");
    console.log("I am in");
}
</script>`enter code here`
about 4 years ago · Juan Pablo Isaza Relatório

0

Try using Ajax and call the function by id or class by button click.

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