Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!