JavaScript is Broken on My Site

My website is “www.actacode.com”. I have some very basic JavaScript on it right now. It’s mainly supposed to scroll to different sections of the site and toggle dark mode.

The website appears as it’s supposed to, and Tailwind CSS looks like it’s working. (The dark mode toggle at least lights up when the mouse goes over it) The only issue is the JavaScript. This is kind of a problem since the next part of the site I need to work on is getting email submission functionality working - kind of important.

Does anybody know what I need to do to make this work?


regarding the toggle

3 Likes

Hi,
Check for any errors or missing functionalities in your JavaScript code related to email submission. Make sure to include event listeners and appropriate DOM manipulation to capture user input and process the email submission. If you encounter specific issues, feel free to provide more details for targeted assistance.
Best of luck :+1:

I checked your site, and one reason why your Javascript might not be working is that the index.js file at http://www.actacode.com/index.js returns a 404 error. Please make sure that the file exists and is uploaded to the right location.

Also, please note that there is a limit of 1 MB for Javascript files on our hosting, files larger than that are deleted automatically.

4 Likes

I’m kind of confused. Everything works when I tested it locally on my computer. I’ll double-check everything, but I’m not sure how “index.js” didn’t get uploaded properly. I’ll update after I check to see what I can do.

Sorry about the double-post, I didn’t realize I wouldn’t be allowed to edit my previous post for whatever reason. (or I just couldn’t find the edit button)

Anyways, I found a fix, though it’s rather strange. My file structure has “index.html” and “index.js” inside of a “dist” sub-folder. Even though they are both in the same folder, when calling the JavaScript file from “index.html”, I can’t point to it via “index.js” or even “./index.js”. Instead, I have to use

“…/dist/index.js”

So, I have to tell it to back up to the main directory, then backtrack into the “dist” folder again even though that’s where it started anyways, in order to find the JavaScript file. This feels weird enough that it’s got to be some sort of bug or something, it makes zero sense that I can’t just point to the file directly since I’m already in the same folder to begin with.

Anyways, thanks for the help, it did point me to the right direction. I spent a majority of the day yesterday trying to re-upload the files with various FTP tools, under the impression that a file didn’t upload correctly. I completely overlooked reviewing the console in Firefox itself to look for errors. Kind of stupid on my part to forget the absolute basic part of troubleshooting.

1 Like

I know this is already off-topic, but for this very doubt of you, new users can’t edit posts. You’ll need at least the “Basic” trust level in order to edit your posts.
So that button currently doesn’t exist for you. And of course you can’t find something that doesn’t exist.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.