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

210
Vistas
Javascript function in external file not getting called

I have a call icon that when clicked should call another function defined in an external JavaScript file

Below is the relevant excerpt from the html code

<!--Angular, JQuery and External JS file defined-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://vmap.com.au/portal/assets/quickstart.js"></script>

<!--Form with call button-->
<form>
<input id="phone-number" type="hidden" value="<?=$phone?>"/>
<a role="button" id="button-call" type="submit"><i class="icon-call-out"></i></a>
</form>

Then we have the external quickstart.js file defined with below sample code

$(function () {
const callButton = document.getElementById("button-call");
callButton.onclick = (e) => {
    e.preventDefault();
    makeOutgoingCall();
  };

async function makeOutgoingCall() {
    alert("Test");
    }
});

<!--At the bottom of the page -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

I am expecting makeOutgoingCall to be called and Test alert to be triggered. But there is no activity in the console, nothing seem to be happening - No errors, no actions.

about 4 years ago · Juan Pablo Isaza
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