Confusion with Script and how it interacts with web pages


#1

So I've been working on Dash as a project for school but I can't get to the FAQ because of internet restrictions. So I returned to Codecademy.

This code below has been causing be loads of problems because of the fact that it will only work when it is put into a provided site by Dash. But when it try to put into the Atom software(don't know if my coding software is the problem) and open it the script below doesn't work. The browser recognizes that script is present but doesn't act upon it.

$('div').on('click', function() {
$(this).toggleClass('show-description');
});

Is the problem with the different programs that are used to act on the code, Dash and Atom, or is it a problem with me coding it incorrectly.

Thanks for the help

P.S, I've already tried using that code in both Chrome and IE and it didn't work in either place. Also, I'm willing to post all of the code if you think it is necessary to find the problem.


#2

Be sure you import the jQuery library.

<script src="https://code.jquery.com/ ... jquery version"></script>

Go here, https://code.jquery.com/ and chose the version (minimized) you want, copy the URL and paste it into the script tag. Be sure it loads before your custom script.


#3

Thanks, it is working now