# CKEditor Sample — Replace Textarea Elements Using JavaScript Code

This sample shows how to automatically replace all `<textarea>` elements with a CKEditor instance by using a JavaScript call.

To replace a `<textarea>` element, place the following call at any point after the `<textarea>` element or inside a `<script>` element located in the `<head>` section of the page, in a `window.onload` event handler:

    CKEDITOR.replace( 'textarea_id' );

Note that `textarea_id` in the code above is the `id` attribute of the `<textarea>` element to be replaced.

Editor 1: <p>This is some <strong>sample text</strong>. You are using <a href="//ckeditor.com/">CKEditor</a>.</p>

Editor 2: <p>This is some <strong>sample text</strong>. You are using <a href="//ckeditor.com/">CKEditor</a>.</p>