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

146
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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