Interview Q&A · questions with model answers

jQuery Interview Questions

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked What is event delegation, and why is it useful?

    Event delegation attaches one handler to a parent element and lets events from children bubble up to it; jQuery's .on(event, selector, handler) runs the handler only when the event came from an…

  2. Most asked What is jQuery, and is it still relevant today?

    jQuery is a JavaScript library (first released in 2006) that simplified DOM selection and manipulation, events, animation and AJAX, and smoothed over browser inconsistencies. Modern browsers now…

  3. Most asked What are jQuery Deferreds, and how do you wait for several requests?

    A Deferred is jQuery's promise implementation: it can be resolved or rejected, and handlers attach with .done(), .fail(), .always() and .then(). $.when(a, b) waits for several deferreds (such as…

  4. Most asked What does $.extend() do, and what is the prototype pollution risk?

    $.extend(target, ...sources) copies properties from source objects into the target (a shallow merge); $.extend(true, target, ...sources) merges deeply. A deep merge of untrusted input in older…

  5. Most asked What are the native JavaScript equivalents of common jQuery operations?

    $(sel) becomes document.querySelectorAll(sel); .addClass/.removeClass/.toggleClass become el.classList.add/remove/toggle; .on() becomes addEventListener (delegation via event.target.closest(sel));…

  6. What is `this` inside a jQuery event handler, and what changes with arrow functions?

    In a normal function handler, this is the DOM element the handler is running for (the matched element in delegated handlers); wrap it as $(this) to use jQuery methods. Arrow functions do not have…

  7. What are namespaced events, and why use them?

    A namespace is a suffix on the event name (click.cart, resize.gallery) that lets you remove or trigger only your own handlers: $(window).off('.gallery') removes every handler in that namespace…

  8. What does jQuery.noConflict() do?

    It releases the $ global back to whatever library defined it before jQuery (historically Prototype.js or MooTools) and returns the jQuery function, so you can use jQuery(...) or your own alias.

  9. What does the $() function actually return?

    A jQuery object: an array-like wrapper around zero or more DOM elements (with length and numeric indexes) plus all jQuery methods on its prototype ($.fn). $() accepts a selector, a DOM element or…

  10. What accessibility problems are common in jQuery-built widgets?

    Custom widgets built from <div>s with click handlers often lack keyboard support, focus management and ARIA semantics: menus that cannot be opened with the keyboard, modals that do not trap or…

Was this page helpful?

Report a mistake