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

240
Views
How to call a function in HTML file from JS module i.e type=module?

I am working on a web project integrated with firebase authentication. So i have created a index.js as :

:--index.js

import { } from "test.js";

function hello(){
  alert("great!!");
}

:--index.html

<!DOCTYPE html>
<html>
    <head>
        <title>Title</title>

        <script type="module" src="index.js"></script>

    </head>

    <body>
        <button onclick="hello()" id="click">Click here</button>
    </body>

</html>

Above are my code whenever i try to call the function it through me an error saying -:

hello function not defined

Can you help me in how to call a function when there is type=module?

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!