tengo el siguiente boton
<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>Que lo quiero cuando se carga para llamar a la función test ()
function test() { console.log("I am in"); }en realidad, esta función creará un popover. Pero no parece estar llamando a la función. (No, onclick o hover no me está ayudando).
¿Alguna sugerencia, idea de cómo lograr eso?
Muchas gracias de antemano.
El evento onload solo se admite en estas etiquetas HTML:
<body> <iframe> <img> <input type="image"> <link> <script> <style>echa un vistazo a: atributo onload HTML
<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`Intente usar Ajax y llame a la función por id o clase haciendo clic en el botón.