How to add src file to html script

  Kiến thức lập trình

forgive me as I am very new to html development. I am trying to call a js function I wrote inside of the file src/backend/script.js. The function is never getting called inside my html file. I know the function works because when I put the js code directly into the html script tag it works fine.

Here is my src/frontend/index.html code that needs editing:

<script src="../backend/script.js"></script> <!-- FIX THIS LINE? -->
<script>
    populateTable(); // never getting called, function is in script.js
</script>

I am currently just running the html code on my local 8080 port to display it using “npx nodemon ./server.js” from within the src/backend folder

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT