JavaScript and the DOM

Review jQuery

Nice work! jQuery is a complete library, and we've only covered the basics. If you're interested in adding animations to websites and creating more dynamic elements, take our jQuery course here.

In this lesson we learned:

  • How to link a JavaScript file to an HTML file using a <script> tag.
  • jQuery is a library to help JavaScript interact with HTML elements.
  • We can make sure our page is ready to go with $(document).ready(). Then, we can pass in a function to ready that will execute when the page is loaded.
  • jQuery uses the same selector names as CSS.
  • We can hide elements with hide, and show them with show.
  • We can make elements appear with fadeIn.
  • on('click') functions allow us to make HTML elements clickable. When an element is clicked, the click function will execute the function we provide. It's full sytnax looks like:
    $('.example-class').on('click', function() {
      // Execute when .example-class is clicked
  • toggle will toggle an element on and off the page.
  • $(this) will select the specific element that was clicked if placed inside a click function.
  • toggleClass can toggle a class on and off.
  • We can select elements next to each other with next.
  • text will replace a DOM element's text with text we specify.
  • slideToggle will make an element slide into and out of the page with an animation.

Impressive work on completing Learn JavaScript!

The next Javascript course, Intermediate JavaScript, is coming soon! In the course you'll learn how to write full-fledged programs in JavaScript.

Until then, try out our jQuery course to make websites more dynamic, or start building applications with JavaScript with our AngularJS course and our React course. AngularJS and React are two application frameworks written in JavaScript. With them, you'll be able to create web applications.

Congrats again on your progress in completing Learn JavaScript!

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.