
Discover how jQuery simplifies web development by manipulating the DOM, selecting elements, and animating with a single line of code, while mastering events, CSS transitions, animations, and Ajax requests.
Why is it important to build a good website? What are the technologies involved?
Amongst all Javascript libraries available, jQuery stands alone. Simple, easy to use and adds so much with so little code!
A brief overview of the DOM before we dive into how jQuery works with it.
Get a web server running and set up your examples.
Download the jQuery uncompressed development file, place it in your project’s lib folder, and adopt a simple naming convention to simplify updates. Ignore source maps for now.
Create the examples directory, ensure it links to the lib directory, run a test html file locally, and verify the example loads correctly.
Explore how hello world in jquery initializes with the dollar function, the window object, and document ready, contrasting with window.onload and the dom loading sequence.
Selectors are the backbone of jQuery. How do you choose the DOM elements that you want to manipulate?
Use the element name, class name and the element id to select DOM elements.
jQuery offers a rich variety of ways by which you can choose elements to perform actions on.
Traverse the dom with jQuery, moving up, down, sideways using functions like parent, closest, siblings, next. Select elements to apply actions and highlight with red to illustrate hierarchy.
Explore advanced jQuery selectors, including even and odd, contains, contains text, and index-based rules, and learn precise element selection using child, greater-than, less-than, and non-human filters.
You can also choose to write code to select DOM elements you're interested in. This is an advanced use case though.
jQuery functions are concise precisely because they can be chained together. This example shows you the power of chaining.
This mode allows jQuery to play nice with other Javascript libraries by surrendering the $ variable to other libraries.
Learn how to access native browser elements directly from a jQuery-like collection by indexing or using square brackets, retrieving the first element, and using dot notation for actions.
Explore how the browser listens for and responds to events. Use JavaScript event handlers and listeners to run callbacks when actions like clicks occur.
Learn to set up event handlers for button clicks with jQuery, using click and on, and explore event delegation with a body listener for all buttons.
All event handlers get an event object as an input argument. This holds meta information about the context in which the event occurred and is very useful.
Demonstrate accessing the event object properties in a click handler using jQuery, logging event type, left mouse button, and the clicked link, and preventing navigation if the link is evil.
Understand how events are propagated in the browser and how jQuery abstracts away all the quirks of when to handle a event.
Discover how a single element can hold multiple event listeners for the same or different events, with three buttons showing ordered execution and the on method for multiple events.
Explore passing data to event handlers by binding properties to the event object with the on method, then access them in the handler to display random Hogwarts houses and costs.
Hook up event handlers so that they fire only for the very first occurrence of an event.
Learn how to manage jQuery event handlers by removing specific or all click handlers with the off method, using function references, and testing via a three-button demo.
Namespaces allow us to work on events in logical groups.
Hook up events to elements which do not exist yet using event delegation.
Explore how to set up delegated events on a parent element so existing and future buttons auto-hook into handlers through event bubbling and dynamic button creation.
Learn how to listen for key up and key down events in jQuery, extract pressed characters from the event object, and display them in real time.
This is a great tool for testing your event code, trigger events without the browser event actually occurring.
A simple DOM component can choose to fire its own custom events.
Learn to create and fire custom color-change events in jQuery, then update each box’s color by triggering and listening with a namespace on boxes and their buttons.
Get introduced to the variety of animations that jQuery enables for us.
Apply the jQuery css() function to change font size with up and down buttons and to get or set multiple properties like color, background color, and font family.
Show how to reveal and hide elements with show() and hide(), using configurable speeds and transitions while preserving and restoring the original display value.
Learn to use jquery's fadeIn and fadeOut to smoothly show and hide articles by fading text opacity, adjusting speeds for fast or slow transitions.
Explore how slideUp() and slideDown() animate showing and hiding elements by sliding them, with adjustable speeds. Also understand default timing and how the height-based CSS illusion creates the effect.
Learn to use the jQuery toggle() function with a single button to show or hide content. Explore slide, fade, and custom speed effects while understanding internal state.
Look behind the scenes at how jQuery manages to smoothly change CSS properties over the duration of the animation.
Learn to run code after a jQuery animation completes using a callback, then highlight text after the feed in, and chain actions for post-animation effects.
Use the jQuery animate() function to change font size and opacity, driven by small, medium, and big buttons, with a two-second duration, swing easing, and a completion callback.
Explore advanced uses of the jQuery animate function by moving text with relative left and up/down changes, while adjusting opacity and applying individual easing functions for each property.
Learn to stop live animations with the stop() function, selectively halting one animation or all animations on multiple Lunacon elements using random animations and stopping in-flight animations.
You can add a delay between every animation that plays using a simple function
Learn how to chain animations in jQuery and queue actions to run in sequence, using add class, the queue method, and next to advance to the next animation.
Animations can be logically bundled together by adding them to custom queues.
Learn how to control chained animations in jQuery by bypassing the queue for select effects, using a configuration object to set duration, easing, and before/after callbacks.
Master manipulating the DOM with jQuery by selecting elements and editing their content. Add, remove, and update elements and attributes to change links and page tone.
Learn how to manipulate element contents with jQuery by updating an element with text or HTML, using input and buttons to get and set content while preserving or escaping markup.
Learn to use attr() and removeAttr() to set, get, and remove attributes on DOM elements, including id, style, and class attributes.
Learn to create new DOM elements and insert them at precise positions relative to existing items using jQuery, including after, before, append, and moving the first item to the end.
Learn to create and clone DOM elements with jQuery by adding new colored boxes, cloning existing ones, and appending them to a container using element creation and configuration objects.
Remove elements from the DOM before editing them as a performance optimization
Demonstrate how jQuery's wrap() and wrapAll() wrap elements: wrap() surrounds each element with a wrapper, while wrapAll() surrounds all elements as a group, illustrated with unicorn rocks boxes.
Learn how to explicitly iterate over all selected elements with jQuery's each(), applying a function to each and updating classes to highlight results.
Explore how Ajax enables asynchronous client-server communication without full page reloads, using requests and callbacks to update only changed page areas, and understand cross-origin resource sharing and restrictions.
Learn to perform server requests with the jQuery $.ajax() method against the G20 API, handle success and failure, populate a table with data, and understand the configuration object and callbacks.
Explore syntactic sugar wrappers in jQuery, such as $.get, $.getScript, and $.getJSON, that simplify ajax requests and render HTML, JSON, or script responses.
Discover how the jQuery load() function performs a get request to fetch HTML and render it into a page element, enabling dynamic content like images and ajax-driven updates.
Serialize form contents with jQuery's serialize() and serializeArray(), producing a query string or an array of input objects. Enforce client-side validation and prevent submission when required fields are missing.
Learn how to use jQuery Ajax events to handle local and global requests, hook into beforeSend, success, error, and complete callbacks, and manage a site-wide loading indicator.
Boost web performance by optimizing server requests and client-side dom rendering. Minimize dom updates by batching changes and delivering small data.
Techniques to reduce the number of times you render the DOM can greatly help improve performance.
NOTE: This course uses jQuery 3.1.0 and jQuery UI 1.12.1
jQuery takes the most common operations that you would want to perform on your website and allows you to accomplish it in one line of code. Learn jQuery by example: from basic building blocks to developing your own custom plugins!
Let's parse that.
What's included in this course: