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

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

0

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

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