0

Old time programmer here but total noob to js with minimal knowledge of html. Don't worry, its growing daily :)
Environment: Win 10, Chrome and just using text editor for now, but will move over to DreamWeaver or something similar once I know I can get a handle on html, css, js etc. (just dodging the ongoing expense for now).

Running through a few quick youtube vids to try and familiarize myself with things. It seems that straight java script works when embeded into an html doc (samples on youtube work locally for me).
However, I downloaded jquery (3.3.1), it does not seem to work. No errors, no messages, nothing

<html> <!-- test4.html -->
<head>
 <title>test 4</title>
 <script>src="js\jquery-3.3.1.js"</script>
 <script>src="js\test.js"</script>
</head>
<body>
  testing
</body>
</html>

I have jquery in the above indicated /js dir and that little test.js is just

// test.js
$(function() {
 alert("Hello World");
});

Apparently this should pop up an alert saying "Hello World" when I browse to localhost/test4.html but no, all I get is a blank page with "testing" on it. So, correct page, but no jquery. Guessing I'm making a noob mistake and haven't set something up here, or I'm doing something wrong. help! I'm trying to get this to work as there appears to be a good deal of ready made code out there that uses jquery. No need to reinvent the wheel so to speak.
Thanks in advance. Philip.

  • 1
    Move the src= inside the first script tag. Like this – Flightdoc5242 Jan 05 '19 at 06:58
  • The error is quite descriptive. Kindly check the accepted answer here: https://stackoverflow.com/questions/2194992/jquery-is-not-defined – Anant Jan 05 '19 at 06:59
  • Thanks guys. Yeah, it was just a really noob mistake, and one I knew better than to make, but I was overlooking it (for 2 days actually... Must be getting old... Damn.) – Philip Middleton Jan 05 '19 at 07:55

1 Answers1

1
<script src="js/jquery-3.3.1.js"></script>
<script src="js/test.js"></script>

thats how u load external js files

you can take a reference on this link https://www.w3schools.com/jquery/jquery_get_started.asp