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

143
Views
HTML doesn't load JS files

i try to make a simple website with external js and css files.

HTML:

<html>


<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <script src="../js/main.js"></script>
  <title> John Doe </title>
</head>

<body>

  <div>
    <p>Landing Page in Progress</p>
    <button onclick="clickAlert()">Test</button>
  </div>

</body>

</html>

JS:

function clickAlert() {
    alert("Test")
}

Folder structure:

folder_structure

But when i click the button i get the error "clickAlert is not defined". Everything is hosted on an Webserver running Ubuntu/Apache. I know that for this simple function i wouldn't need an external file but i want to expand the site more. Thanks for every help!

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You should put the js folder in the static folder then put the src as "js/main.js". If the javascript is not included in the static folder, the server doesn't know to put those files on the server.

about 4 years ago · Santiago Trujillo Report
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!