What is jQuery?
About this video
jQuery is the most popular library on the web: a library of JavaScript functions that makes common tasks like manipulating the page, responding to events, getting data from servers and animations easier. It builds on the browser's JavaScript DOM API but needs fewer lines of code, as shown by resizing all images in one line instead of four, and it handles cross-browser bugs. In 2014 over 60 percent of the top million webpages included jQuery.
You'll be able to
- explain what jQuery is and what kinds of tasks it helps with.
- explain how jQuery relates to the JavaScript DOM API.
- give two reasons developers use jQuery (fewer lines of code, handles cross-browser bugs).
Key words
- library
- A collection of ready-made functions you can use so you don't have to write everything yourself.
- jQuery
- A popular JavaScript library that makes common webpage tasks quicker to write.
- DOM API
- The set of JavaScript functions browsers provide for accessing and changing a webpage.
- cross-browser bugs
- Problems where the same code behaves differently in different web browsers.
Transcript
jQuery is the most popular library on the web today. It's a library of JavaScript functions that make it easy for webpage developers to do common tasks-- like manipulating the webpage, responding to user events, getting data from their servers, building effects and animations, and much more.
jQuery builds on top of the functionality that browsers give us via the JavaScript DOM API, but lets us accomplish the same things in fewer lines of code. For example, let's say you wanted to resize all of the images on your page, like when the user clicked a button.
You could write these four lines of code here, and that would work. Or, you could write this single line of code, and jQuery will do all the heavy lifting for you. Plus, jQuery takes care of any cross-browser bugs or inconsistencies. In 2014, over 60 percent of the top million webpages included jQuery.
So, pretty much all web developers either know jQuery, or have used jQuery at some point in their career. And now you can become one of those developers.
Video © Khan Academy, used under CC BY-NC-SA. Watch on Khan Academy. Puzzicle is not affiliated with Khan Academy.