Tell us what’s happening:
<head> of .html but it’s not working.
Challenge: Build a Random Quote Machine
You need to put it right before closing a
body tag to allow HTML to load before the script. In HTML section as
<script> is HTML tag
Thanks snigo for answer. I have tried that as well but it isn’t working.
I did try to add after
<script src="js/main.js"></script> but still no luck.
Can you show the full code of the html file.? The actual code and not a screen shot. Also, are you seeing any errors in the browser console? What is the folder structure of your project (you can provide a screen shot of that)?
still no luck
How do you test presence of jQuery in the scope?
You can easily check if jQuery is being shipped by accessing this
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js in the browser, and to me, it works meaning that you have it in the scope
Here is the code of .html
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Quote Machine</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style.scss">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.10.2/css/all.css">
<i class="fa fa-quote-left"> </i><span id="text"></span> <i class="fas fa-quote-right"></i>
- <span id="author"></span>
<a class="button" id="tweet-quote" title="Tweet this quote!" target="_blank">
<i class="fab fa-twitter"></i>
<button class="button" id="new-quote">New quote</button>
<div class="footer"> <a href="https://www.linkedin.com/in/zaid-irfan-khan-9a4b964b/" target="_blank">Zaid</a></div>
And the Screenshot of the folder structure.
(Not a folder structure though)
you have js/main but your main.js is not in a js folder, it should be
It does show us your folder structure. You can see
@biscuitmanz’s reply for what the issue is.
Thanks biscuitmanz, I fixed it but I couldn’t get work my jquery CDN.
Yes I fixed it, but still my CDN link it’s not working.
Can you elaborate on what is “not working”? We do not know what you are trying to achieve inside
main.js, because we can not see its contents.
Here is the project link on Codepen.
I am trying to get the same results on my local machine and after debugging I realized it’s the jQuery CDN Link which is not picking up.
Here is the Screenshot of the project on my local machine.
Thank you, everyone, I got the solution, I checked, I had added jQuery CDN Link in my .js file as well. I removed it from there and It worked.
But probably the main issue was
js/main.js instead of