---
title: How to Create a Module
description: Write custom modules for Jodit editor.
keywords: jodit module, custom module, editor module
---

# How to create module for Jodit Editor

You can write your own module for Jodit. For example create Dummy module, which will insert some code in editor Create file Dummy.js with this content

```js
Jodit.modules.Dummy = function (editor) {
	this.insertDummyImage = function (w, h, textcolor, bgcolor) {
		const image = editor.createInside.element('img');
		image.setAttribute(
			'src',
			'http://dummyimage.com/' +
				w +
				'x' +
				h +
				'/' +
				(textcolor || '000') +
				'/' +
				(bgcolor || 'fff')
		);
		editor.selection.insertNode(image);
		editor.setEditorValue(); // for syncronize value between source textarea and editor
	};
};
```

You need include this file after include jodit.min.js

```html
<link type="text/css" rel="stylesheet" href="build/jodit.min.css" />
<script type="text/javascript" src="build/jodit.min.js"></script>
<script type="text/javascript" src="Dummy.js"></script>
```

Now you can use this module. For example will append button in toolbar

```js
Jodit.make('#editor', {
	buttons: [
		'bold',
		'italic',
		{
			iconURL: 'images/dummy.png',
			tooltip: 'insert Dummy Image',
			exec: function (editor) {
				editor.dummy.insertDummyImage(100, 100, 'f00', '000');
			}
		}
	],
	events: {
		afterInit: function (editor) {
			editor.dummy = new Jodit.modules.Dummy(editor);
		}
	}
});
```

Or you can use your mode like this:

```js
var editor = new Jodit('#textareaid');
editor.getInstance('Dummy').insertDummyImage(100, 100, 'f00', '000');
```

That's all. You can try this example here

`{example InsertDummy}`
