I was working with jQuery on https://codepen.io/ and to include jQuery is very easy. So i decided to work on files on my computer, i tried to include it using the file and it didn't work. also i tried to include from CDN but still doesn't work.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="js/Web.js"></script>
and in the Web.js i put this code:
<button id="btn">Hide</button>
<p id="para">A dpara.</p>
Your
Web.js
isn't a javascript file, but rather an HTML-file. You want to create a new HTML file named for exampleindex.html
. You fill this one up like so:You should be able to use jQuery as you wish now.
Also, this is the folder structure you should have with the above example: