melkadri melkadri - 1 year ago 88
Javascript Question

External javascript not working?

I just started learning javascript about 30 minutes ago. I'm doing an online course and they gave me this code as an example. The person in the video did the exact same thing, but it only works for me when I do inline not external. My .js name is right and they're in the same folder.

The html:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>JavaScript Basics</title>
<script src=“cripts.js”></script>
<div class="container">
<h1>Where to place your JavaScript code.</h1>

and the js:


Nothing appears for me. I've tried everything to make it work, including different browsers. Could it be my computer or did I make a simple mistake?

Answer Source

It looks like your quotes are invalid :') Good beginner move! But it will be a simple fix. Note the should be ", this usually happens when copying and pasting code!

<script src="cripts.js"></script>

Also make sure your path and file name is correct?! cripts.js sounds like it is suppose to be scripts.js

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download