# jQuery Installation

> Add the Editor42 WYSIWYG HTML editor to a jQuery page with @editor42/editor42-jquery, a drop-in replacement for @tinymce/tinymce-jquery. No API key.

Source: https://editor42.com/docs/install/jquery  
Section: Installation > Integrations > jQuery  
Every page of editor42.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://editor42.com/llms-full.txt

`@editor42/editor42-jquery` is a thin wrapper around Editor42 that makes it a jQuery plugin. There is no account, no sign-up and no key of any kind.

It patches `.val()`, `.html()`, `.text()`, `.append()`, `.prepend()`, `.remove()`, `.empty()` and `.attr()` so they work naturally against editor-bound elements — reading from and writing to the editor instead of the hidden textarea underneath it.

## Install

```sh
npm install @editor42/editor42-jquery
```

or for Yarn users:

```sh
yarn add @editor42/editor42-jquery
```

## Basic Setup

Load jQuery first, then the integration:

```html
<script src="jquery.min.js"></script>
<script src="node_modules/@editor42/editor42-jquery/dist/editor42-jquery.js"></script>

<textarea id="editor"></textarea>
<script>
  $('#editor').editor42({ height: 400 });
</script>
```

With no `script_url` the editor script is loaded from `https://cdn.editor42.com` on the `latest` channel. That pointer only ever moves for security and bug-fix releases, because the Editor42 major version is fixed forever.

## Reading and Writing the Content

Once an element is bound, the usual jQuery accessors talk to the editor:

```js
$('#editor').html();                     // the editor's HTML
$('#editor').html('<p>New content</p>'); // replaces it

$('*:editor42');                         // every element bound to an editor
```

## Self-Hosting

```js
$('#editor').editor42({ script_url: '/js/editor42/editor42.min.js' });
```

Any full script URL works.

## Pinning a Version

```js
$('#editor').editor42({ channel: '42.0.1' });
```

`channel` accepts `latest`, a `latest-N` alias, or an exact version.

## Editor Options

Everything else is an Editor42 option, passed in the same settings object:

```js
$('#editor').editor42({ height: 400, menubar: false, plugins: 'lists link' });
```

See the [Configuration Options](https://editor42.com/api/configuration) for the full list.

## Migrating from @tinymce/tinymce-jquery

```sh
npm uninstall @tinymce/tinymce-jquery
npm install @editor42/editor42-jquery
```

`$(el).tinymce(settings)` and the `:tinymce` pseudo keep working as deprecated aliases of `$(el).editor42(settings)` and `:editor42`. `script_url`, `channel`, `script_loaded` and `oninit` keep their names, and TinyMCE-style numeric channels resolve to `latest`.

All API-key and licence-key handling has been removed. The `api_key` setting is still accepted so existing code compiles, but it does nothing: no key is read, stored or sent anywhere, and no request ever reaches a vendor cloud.

The integration also drives a stock TinyMCE if that is what is already loaded on the page, which keeps the switch reversible.

See the [migration guide](https://editor42.com/docs/migration/from-tinymce) for the editor side of the move.

## Live Demo

See it running, with its full source: the [jQuery demo](https://editor42.com/examples/jquery).

## Links

- NPM: [`@editor42/editor42-jquery`](https://www.npmjs.com/package/@editor42/editor42-jquery)
- GitHub: [editor42com/editor42-jquery](https://github.com/editor42com/editor42-jquery)
