Skip to content
Skills Library
Programming · Building & coding

jquery

/jquery

Expert jQuery assistance covering DOM manipulation, AJAX, event delegation, and legacy web migration. Use when maintaining or refactoring classic JavaScript web applications.

Licence
MIT
Last repository change
01.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert jQuery assistance covering DOM manipulation, AJAX, event delegation, and legacy web migration. Use when maintaining or refactoring classic JavaScript web applications.

Original author description

Expert jQuery assistance covering DOM manipulation, AJAX, event delegation, and legacy web migration. Use when maintaining or refactoring classic JavaScript web applications.

How it works

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Original SKILL.md headings · 166 lines, 592 words
SKILL.md preview
---
name: jquery
description: Expert jQuery assistance covering DOM manipulation, AJAX, event delegation, and legacy web migration. Use when maintaining or refactoring classic JavaScript web applications.
---

# jQuery

jQuery is a fast, small, and feature-rich JavaScript library that simplifies HTML DOM traversal, event handling, animation, and Ajax interactions for legacy web architectures.

## When to Use

- **Legacy Web Application Maintenance**: Maintaining and extending established web applications, themes, and portals.
- **WordPress & CMS Plugin Development**: Supporting traditional WordPress, Drupal, or Magento themes requiring jQuery.
- **Quick DOM Manipulation Scripts**: Adding simple animations, modal toggles, and AJAX calls to server-rendered pages.
- **Third-Party jQuery Plugin Integrations**: Utilizing established plugins (DataTables, Select2, Slick Carousel).

## Quick Start

```html
<!doctype html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
  </head>
  <body>
    <button id="btn">Click Me</button>
    <div id="output"></div>

    <script>
      $(document).ready(function () {
        $("#btn").on("click", function () {
          $("#output").text("Button clicked!").fadeIn();
        });
      });
    </script>
  </body>
</html>
```

## Core Concepts

### DOM Traversal & Event Delegation

Handling events dynamically for current and future DOM nodes:

```javascript
$(document).ready(function () {
  // Event delegation on dynamic table rows
  $("#product-table").on("click", ".delete-btn", function (event) {
    event.preventDefault();
    const row = $(this).closest("tr");
    const productId = row.data("product-id");

    if (confirm("Delete this product?")) {
      $.ajax({
        url: `/api/products/${productId}`,
        method: "DELETE",
        success: function () {
          row.fadeOut(300, function () {
            $(this).remove();
          });
        },
        error: function (xhr, status, error) {
          alert("Failed to delete: " + error);
        },
      });
    }
  });
});
```

### AJAX Requests with Promises

Modern asynchronous requests using jQuery Deferred:

```javascript
function fetchUserData(userId) {
  return $.getJSON(`/api/v1/users/${userId}`)
    .then(function (user) {
      $("#profile-name").text(user.name);
      $("#profile-email").text(user.email);
      return user;
    })
    .catch(function (error) {
      console.error("Error fetching user data:", error);
      $("#profile-error").show().text("User could not be loaded.");
    });
}
```

### Writing a Custom jQuery Plugin

Encapsulating reusable UI behavior following standard plugin conventions:

```javascript
(function ($) {
  $.fn.characterCounter = function (options) {
    const settings = $.extend({ maxChars: 140, warningThreshold: 10 }, options);

    return this.each(function () {
      const $textarea = $(this);
      const $badge = $('<span class="char-counter badge"></span>').insertAfter(
        $textarea,
      );

      function update() {
        const remaining = settings.maxChars - $textarea.val().length;
        $badge.text(remaining + " remaining");
        $badge.toggleClass(
          "badge-warning",
          remaining <= settings.warningThreshold,
        );
      }

      $textarea.on("input keyup", update);
      update();
    });
  };
})(jQuery);
```

## Common Patterns

### Event Delegation for Dynamically Injected Elements

**Problem**: Click handlers do not fire on elements injected after initial `$(document).ready()`.

**Solution**:
Delegate events from a static parent container:

```javascript
// Delegate click event from persistent parent to dynamic child items
$("#items-container").on("click", ".delete-btn", function (e) {
  e.preventDefault();
  const itemId = $(this).data("id");
  $(this)
    .closest(".item-row")
    .fadeOut(300, function () {
      $(this).remove();
    });
});
```

## Best Practices

**Do**:

- Always use event delegation (`$(parent).on('event', '.child', fn)`) for dynamically added DOM elements.
- Cache jQuery selector lookups (`const $list = $('#list');`) rather than re-querying the DOM in loops.
- Target jQuery 3.7+ or higher to ensure security patches and modern browser compatibility.
- Migrate simple DOM tasks to native Vanilla JavaScript (`querySelector`, `fetch`, `classList`) where practical.

**Don't**:

- Load full jQuery in greenfield projects if native browser APIs or modern micro-libraries suffice.
- Use synchronous AJAX (`async: false`); it freezes the browser UI thread.
- Inject untrusted user strings with `.html()`; use `.text()` to prevent XSS attacks.

## Troubleshooting

| Error                                           | Cause                                                                | Solution                                                                       |
| :---------------------------------------------- | :------------------------------------------------------------------- | :----------------------------------------------------------------------------- |
| `Uncaught TypeError: $ is not a function`       | jQuery loaded after script, or running in `noConflict()` mode.       | Wrap script in `jQuery(function($) { ... })` or ensure jQuery CDN loads first. |
| `Event handler firing multiple times`           | Event listener bound repeatedly inside loop or multiple ready calls. | Call `$("#btn").off("click").on("click", ...)` to unbind duplicates.           |
| `Cross-Origin Request Blocked (CORS) in $.ajax` | Target API lacks CORS headers for cross-domain requests.             | Configure CORS headers on server or proxy requests via same origin.            |

## References

- [jQuery Documentation](https://jquery.com/)

Versions

RepositoryScoreLicence
This page · G1Joshi/Agent-Skills100MIT
fabiensalles/claude-marketplace95MIT

Database snapshot: 13.11.2026 · package version 054c708b1948 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100fec-legacy-web-standard
    Use when maintaining or safely modifying existing non-framework frontend code: vanilla JavaScript, jQuery, HTML/CSS, MPA pages, server-rendered templates, legacy plugins, or long-lived code that should stay in its current stack. Use migration skill when planning a move to…
  • 100fec-legacy-to-modern-migration
    Use when planning or implementing an intentional migration from JavaScript, jQuery, HTML/CSS, server-rendered templates, MPA legacy frontend code, or older framework code toward a modern frontend stack while preserving behavior. Do not use for routine legacy bug fixes that stay…
  • 100javascript
    Expert modern JavaScript (ES2024+) assistance covering closures, async/await, promises, modules, event loop concurrency, and DOM manipulation. Use when writing frontend or Node.js code, designing clean asynchronous flows, or modernizing legacy JavaScript.
  • 100browser-dom-manipulation-events
    Use this skill when implementing vanilla DOM mutations, event delegation, custom events, and passive scroll listeners for maximum browser performance.
  • 91modernize-ui5-app
    Convert a legacy UI5 freestyle JavaScript app (sync bootstrap, jQuery.sap.*, ES5, sap_belize) into a modern UI5 1.147 TypeScript app with sap.f.FlexibleColumnLayout, typed event handlers, ES modules, BaseController, and sap_horizon — with 5 documented critical traps up front.…
  • 90sentry-browser-sdk
    Full Sentry SDK setup for browser JavaScript. Use when asked to "add Sentry to a website", "install @sentry/browser", or configure error monitoring, tracing, session replay, or logging for vanilla JavaScript, jQuery, static sites, or WordPress.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.