Skip to content
Justice Tech School

jQuery Tutorial

Select, animate and update web pages with the classic JavaScript library.

Start learning jQuery
Getting started6 lessons
  1. 1jQuery IntroductionjQuery is a small JavaScript library that makes selecting elements, handling events, anima.
  2. 2jQuery Get StartedAdd jQuery with a script tag from a CDN or install it with npm.
  3. 3jQuery SyntaxThe basic form is $(selector).action().
  4. 4The Document Ready EventWrap code in a ready handler so it runs after the DOM has loaded.
  5. 5jQuery versus Plain JavaScriptModern JavaScript has querySelector, classList and fetch, so many jQuery tasks are now one.
  6. 6Method ChainingMost jQuery methods return the jQuery object, so you can chain several actions in one stat.
Selectors6 lessons
  1. 7Basic SelectorsjQuery uses CSS selectors: tag names, #id and .class.
  2. 8Combining SelectorsUse commas to select several groups, spaces for descendants and > for direct children.
  3. 9Filter SelectorsjQuery adds filters such as :first, :even, :odd, :visible and :hidden.
  4. 10Attribute and Form SelectorsSelect by attributes with brackets and by form type with :text, :checked and :selected.
  5. 11The this KeywordInside an event handler, this is the DOM element that triggered it.
  6. 12Selector PerformanceID selectors are fastest, class selectors next.
Events6 lessons
  1. 13Click and Mouse Eventsclick, dblclick, mouseenter, mouseleave and hover react to the mouse.
  2. 14Keyboard and Form Eventskeydown, keyup and keypress track typing.
  3. 15The on() Methodon attaches one or more handlers, and off removes them.
  4. 16Event DelegationAttach one handler to a parent and give a selector so it also works for elements added lat.
  5. 17The Event ObjectThe handler receives an event with details such as target, pageX, key and which.
  6. 18Triggering and Custom Eventstrigger fires an event from code.
Effects6 lessons
  1. 19Hide, Show and Togglehide, show and toggle change visibility, optionally with a speed such as slow, fast or mil.
  2. 20FadingfadeIn, fadeOut, fadeToggle and fadeTo change opacity over time.
  3. 21SlidingslideDown, slideUp and slideToggle animate height.
  4. 22Custom Animationsanimate changes numeric CSS properties over time.
  5. 23Stop, Delay and Queuestop ends the running animation, delay pauses the queue and finish jumps to the end.
  6. 24Prefer CSS for Simple EffectsCSS transitions and animations run on the GPU and are smoother than jQuery animations.
DOM manipulation8 lessons
  1. 25Get and Set Contenttext, html and val read or write content.
  2. 26Attributes and Propertiesattr reads and writes attributes.
  3. 27Add Elementsappend and prepend add inside an element, after and before add outside.
  4. 28Remove Elementsremove deletes elements and their data, empty clears the children, detach keeps data for r.
  5. 29Working with ClassesaddClass, removeClass, toggleClass and hasClass control classes.
  6. 30The css() Methodcss reads and writes style properties.
  7. 31Dimensions and Positionwidth and height get content size, innerWidth adds padding, outerWidth adds border, offset.
  8. 32Clone, Wrap and Replaceclone copies elements, wrap puts a wrapper around them and replaceWith swaps them for some.
Traversing14 lessons
  1. 33Parents and Childrenparent, parents, children and closest move up and down the tree.
  2. 34Siblingssiblings, next, prev, nextAll and prevUntil move sideways between elements with the same p.
  3. 35Filteringfirst, last, eq, filter, not and has narrow a selection.
  4. 36Looping with eacheach runs a function for every element.
  5. 37find versus childrenfind searches all descendants and children only direct ones.
  6. 38Parent Methodsparent, parents and closest walk up the tree.
  7. 39Children and Findchildren looks one level down and find goes deep.
  8. 40Siblingssiblings, next, prev, nextAll and prevAll move sideways.
  9. 41filter, not, first, last, eqNarrow a set of matches.
  10. 42each Loopeach runs a function on every match.
  11. 43map, is and hasTransform sets and test conditions.
  12. 44ChainingMost methods return the jQuery object so calls can chain.
  13. 45length and indexlength counts matches and index finds position.
  14. 46add, end and andSelfCombine sets and step back in a chain.
AJAX6 lessons
  1. 47AJAX IntroductionAJAX loads data from the server without reloading the page.
  2. 48get and post$.get reads data and $.post sends it.
  3. 49The load() Methodload fetches HTML from a URL and puts it into the selected element.
  4. 50JSON DatagetJSON fetches and parses JSON.
  5. 51Promises and DeferredsAJAX methods return a jqXHR with done, fail and always.
  6. 52Submitting Forms with AJAXserialize turns form fields into a query string.
Advanced jQueryPremium11 lessons
  1. 53Writing a PluginA plugin adds methods to $.fn so every selection can use them.
  2. 54extend and Options$.extend merges objects, which plugins use to combine defaults and user options.
  3. 55The data() Storedata stores values on elements without touching the DOM attributes, and removeData clears .
  4. 56Deferred Objects$.Deferred lets you create your own async tasks.
  5. 57Event NamespacesAdd a namespace to event names such as click.menu so you can remove just your handlers.
  6. 58jQuery UIjQuery UI adds widgets such as datepicker, dialog, sortable and autocomplete plus interact.
  7. 59Custom Selectors and FiltersExtend jQuery with your own pseudo selectors through $.expr.
  8. 60Global AJAX Setup and ErrorsajaxSetup sets defaults and global events such as ajaxStart show spinners.
  9. 61CORS, JSONP and SecurityBrowsers block cross origin requests unless the server allows them with CORS.
  10. 62Chaining Requeststhen lets you run requests one after another, and when runs them in parallel.
  11. 63Upgrading and jQuery MigratejQuery 3 removed many old methods such as bind and live.
jQuery in practicePremium10 lessons
  1. 64Build an AccordionShow one panel at a time.
  2. 65Build TabsUse href or data attributes to link a tab with its panel.
  3. 66Form ValidationCheck fields on submit, show messages beside them and block sending when invalid.
  4. 67Live Search FilterFilter a list as the user types by toggling items that match the text.
  5. 68Build a ModalShow an overlay and dialog, close on a button, on the overlay click and on the Escape key.
  6. 69Infinite Scroll and Lazy LoadingListen to scroll, check how near the bottom you are and load the next page.
  7. 70Debugging jQueryCheck that the selection found elements with length, log with console.log and use browser .
  8. 71Performance TipsCache selectors, delegate events, batch DOM writes, avoid layout thrashing and use CSS for.
  9. 72Moving from jQuery to Vanilla JSReplace methods with native ones step by step: querySelector, classList, addEventListener,.
  10. 73jQuery Best PracticesLoad jQuery at the end of body, cache selections, use delegation, avoid inline handlers, p.
jQuery foundations12 lessons
  1. 74Document ReadyRun code after the DOM is ready.
  2. 75Basic SelectorsUse CSS selectors inside $().
  3. 76Selector FiltersFilters like :first, :even, :not and :contains refine matches.
  4. 77text, html and valtext reads text, html reads markup and val reads form values.
  5. 78attr and propattr reads attributes and prop reads live properties.
  6. 79css Methodcss reads and sets styles.
  7. 80ClassesaddClass, removeClass, toggleClass and hasClass manage classes.
  8. 81Width and Heightwidth, height, innerWidth and outerHeight measure elements.
  9. 82Adding Contentappend, prepend, before and after insert content.
  10. 83Removing Contentremove deletes elements and empty clears children.
  11. 84Cloningclone copies elements, optionally with events.
  12. 85Wrapping Elementswrap, wrapAll and unwrap change structure.
Effects and animation8 lessons
  1. 86show, hide and toggleControl visibility with optional speed.
  2. 87FadingfadeIn, fadeOut, fadeToggle and fadeTo change opacity.
  3. 88SlidingslideUp, slideDown and slideToggle animate height.
  4. 89animateanimate changes numeric CSS properties over time.
  5. 90stop and delaystop halts animations and delay pauses the queue.
  6. 91Animation QueueAnimations queue in order on the same element.
  7. 92Effect CallbacksA callback runs after the effect finishes.
  8. 93CSS vs jQuery AnimationPrefer CSS transitions for simple effects and toggle a class.
Events and forms10 lessons
  1. 94click EventsAttach handlers with click and other shortcuts.
  2. 95on and offon attaches handlers and off removes them.
  3. 96The Event ObjectThe handler receives an event with target and coordinates.
  4. 97Event DelegationAttach one handler to a parent for dynamic children.
  5. 98Keyboard Eventskeydown, keyup and keypress respond to keys.
  6. 99Form Eventssubmit, change, focus, blur and input respond to forms.
  7. 100focus and blurRespond when an input gains or loses focus.
  8. 101trigger and custom eventstrigger fires an event in code.
  9. 102Simple Form ValidationCheck values and show errors.
  10. 103Mouse Eventsmouseenter, mouseleave, mousemove and contextmenu.
AJAX and utilities9 lessons
  1. 104loadload fetches HTML into an element.
  2. 105get and postShortcut methods for GET and POST.
  3. 106$.ajax$.ajax gives full control.
  4. 107getJSONgetJSON loads and parses JSON.
  5. 108Promises and DeferredAjax returns a promise like object.
  6. 109Utility Functions$.trim, $.isArray, $.extend and $.map help with data.
  7. 110noConflictRelease $ when another library uses it.
  8. 111data Methoddata stores values on elements.
  9. 112Storage and CookiesUse localStorage with jQuery for simple saving.
Plugins and practice12 lessons
  1. 113Writing a PluginExtend $.fn to add methods.
  2. 114jQuery UI IntrojQuery UI adds widgets like datepicker and sortable.
  3. 115Project: AccordionToggle panels with a click.
  4. 116Project: TabsSwitch visible panels with classes.
  5. 117Project: ModalOpen and close a dialog.
  6. 118Project: Todo ListAdd and remove items with delegation.
  7. 119Project: Live FilterFilter rows as you type.
  8. 120Performance TipsCache selectors, use delegation and avoid heavy loops.
  9. 121jQuery and Vanilla JSModern JavaScript covers many jQuery tasks.
  10. 122Project: Image SliderRotate images with a timer.
  11. 123Project: AJAX FormSubmit a form without reloading.
  12. 124Debugging jQueryCheck selections with length and console.
Next steps1 lessons
  1. 125Next StepsPractise by building a slider, a tab set and a form validator.