Migrate jQuery 3.x to 4.0.0 safely in WordPress and legacy web projects. Covers all breaking changes: removed APIs ($.isArray, $.trim, $.parseJSON, $.type), focus event order changes, slim build differences, ES modules migration, and Trusted Types support. Use when: upgrading jQuery to 4.0, fixing "$.isArray is not a function" errors, WordPress jQuery migration, updating legacy JavaScript, or troubleshooting focus/blur event order issues.
View on GitHubSelect agents to install to:
npx add-skill https://github.com/jezweb/claude-skills/blob/main/skills/jquery-4/SKILL.md -a claude-code --skill jquery-4Installation paths:
.claude/skills/jquery-4/# jQuery 4.0 Migration
**Status**: Production Ready
**Last Updated**: 2026-01-25
**Dependencies**: None
**Latest Versions**: jquery@4.0.0, jquery-migrate@4.0.2
---
## Quick Start (5 Minutes)
### 1. Add jQuery Migrate Plugin for Safe Testing
Before upgrading, add the migrate plugin to identify compatibility issues:
```html
<!-- Development: Shows console warnings for deprecated features -->
<script src="https://code.jquery.com/jquery-4.0.0.js"></script>
<script src="https://code.jquery.com/jquery-migrate-4.0.2.js"></script>
```
**Why this matters:**
- Logs specific warnings when deprecated/removed features execute
- Identifies code that needs updating before it breaks
- Provides backward compatibility shims during transition
### 2. Install via npm (if using build tools)
```bash
npm install jquery@4.0.0
# Or with migrate plugin for testing
npm install jquery@4.0.0 jquery-migrate@4.0.2
```
### 3. Check for Breaking Changes
Run your application and check console for migrate plugin warnings. Each warning indicates code that needs updating.
---
## Breaking Changes Reference
### Removed jQuery Utility Functions
These functions were deprecated and are now removed. Use native JavaScript equivalents:
| Removed | Native Replacement |
|---------|-------------------|
| `$.isArray(arr)` | `Array.isArray(arr)` |
| `$.parseJSON(str)` | `JSON.parse(str)` |
| `$.trim(str)` | `str.trim()` or `String.prototype.trim.call(str)` |
| `$.now()` | `Date.now()` |
| `$.type(obj)` | `typeof obj` + `Array.isArray()` + `instanceof` |
| `$.isNumeric(val)` | `!isNaN(parseFloat(val)) && isFinite(val)` |
| `$.isFunction(fn)` | `typeof fn === 'function'` |
| `$.isWindow(obj)` | `obj != null && obj === obj.window` |
| `$.camelCase(str)` | Custom function (see below) |
| `$.nodeName(el, name)` | `el.nodeName.toLowerCase() === name.toLowerCase()` |
**camelCase replacement:**
```javascript
// Native replacement for $.camelCase
function camelCase(str) {
return str.replace(/-([a-z])/g, (