Simple WYSISWYG Rich Text Editor with jQuery and Bootstrap

Simple WYSISWYG Rich Text Editor with jQuery and Bootstrap
File Size: 36 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

A simple jQuery plugin used to attach a customizable WYSISWYG rich text editor toolbar to your editable area, styled with Bootstrap and Font Awesome.


  • Custom hotkey bindings.
  • Drag and drop images.
  • file upload error callback.

How to use it:

1. Load the jQuery library and other required resources in the document.

<link rel="stylesheet" href="//">
<link rel="stylesheet" href="">

<script src=""></script>
<script src="jquery.hotkeys.js"></script>
<script src=""></script>

2. Load the jQuery Bootstrap Wysiwyg plugin after jQuery library.

<script src="src/bootstrap-wysiwyg.js"></script>

3. Create a basic Html editor with custom editor buttons as follows.

<div class="btn-toolbar" data-role="editor-toolbar"
    <div class="btn-group"> <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
      title="Font Size"><i class="fa fa-text-height"></i>&nbsp;<b
      class="caret"></b> </a>
      <ul class="dropdown-menu">
        <li><a data-edit="fontSize 5"><font size="5">Huge</font> </a> </li>
        <li><a data-edit="fontSize 3"><font size="3">Normal</font> </a> </li>
        <li><a data-edit="fontSize 1"><font size="1">Small</font> </a> </li>
    <div class="btn-group"> <a class="btn btn-default" data-edit="bold"
      title="Bold (Ctrl/Cmd+B)"><i class="fa fa-bold"></i> </a> <a class="btn btn-default" data-edit="italic"
      title="Italic (Ctrl/Cmd+I)"><i class="fa fa-italic"></i> </a> <a class="btn btn-default" data-edit="strikethrough"
      title="Strikethrough"><i class="fa fa-strikethrough"></i> </a> <a class="btn btn-default" data-edit="underline"
      title="Underline (Ctrl/Cmd+U)"><i class="fa fa-underline"></i> </a> </div>
    <div class="btn-group"> <a class="btn btn-default" data-edit="insertunorderedlist"
      title="Bullet list"><i class="fa fa-list-ul"></i> </a> <a class="btn btn-default" data-edit="insertorderedlist"
      title="Number list"><i class="fa fa-list-ol"></i> </a> <a class="btn btn-default" data-edit="outdent"
      title="Reduce indent (Shift+Tab)"><i class="fa fa-outdent"></i> </a> <a class="btn btn-default" data-edit="indent" title="Indent (Tab)"><i
      class="fa fa-indent"></i> </a> </div>
    <div class="btn-group"> <a class="btn btn-default" data-edit="justifyleft"
      title="Align Left (Ctrl/Cmd+L)"><i class="fa fa-align-left"></i> </a> <a class="btn btn-default" data-edit="justifycenter"
      title="Center (Ctrl/Cmd+E)"><i class="fa fa-align-center"></i> </a> <a class="btn btn-default" data-edit="justifyright"
      title="Align Right (Ctrl/Cmd+R)"><i class="fa fa-align-right"></i> </a> <a class="btn btn-default" data-edit="justifyfull"
      title="Justify (Ctrl/Cmd+J)"><i class="fa fa-align-justify"></i> </a> </div>
    <div class="btn-group"> <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"
      title="Hyperlink"><i class="fa fa-link"></i> </a>
      <div class="dropdown-menu input-append">
        <input class="span2" placeholder="URL" type="text"
      	data-edit="createLink" />
        <button class="btn" type="button">Add</button>
    <div class="btn-group"> <a class="btn btn-default" data-edit="unlink"
      title="Remove Hyperlink"><i class="fa fa-cut"></i> </a> <a class="btn btn-default"
      title="Insert picture (or just drag & drop)" id="pictureBtn"> <i class="fa fa-picture-o"></i>
      <input type="file"
      data-role="magic-overlay" data-target="#pictureBtn"
      data-edit="insertImage" />
      </a> </div>
    <div class="btn-group"> <a class="btn btn-default" data-edit="undo"
      title="Undo (Ctrl/Cmd+Z)"><i class="fa fa-undo"></i> </a> <a class="btn btn-default" data-edit="redo"
      title="Redo (Ctrl/Cmd+Y)"><i class="fa fa-repeat"></i> </a> <a class="btn btn-default" data-edit="html"
      title="Clear Formatting"><i class='glyphicon glyphicon-pencil'></i> </a> </div>

4. Call the plugin to initialize the Html editor with default settings.


5. All the default settings.

hotKeys: {
  'Ctrl+b meta+b': 'bold',
  'Ctrl+i meta+i': 'italic',
  'Ctrl+u meta+u': 'underline',
  'Ctrl+z': 'undo',
  'Ctrl+y meta+y meta+shift+z': 'redo',
  'Ctrl+l meta+l': 'justifyleft',
  'Ctrl+r meta+r': 'justifyright',
  'Ctrl+e meta+e': 'justifycenter',
  'Ctrl+j meta+j': 'justifyfull',
  'Shift+tab': 'outdent',
  'tab': 'indent'
toolbarSelector: '[data-role=editor-toolbar]',
commandRole: 'edit',
activeToolbarClass: 'btn-info',
selectionMarker: 'edit-focus-marker',
selectionColor: 'darkgrey',
dragAndDropImages: true,
keypressTimeout: 200,
fileUploadError: function (reason, detail) { 
  console.log("File upload error", reason, detail); 

Change log:

v2.0.1 (2016-12-17)

v1.0.4 (2015-09-30)

  • Bug fixes
  • Fixed activeToolbarClass only applied to first button
  • Fixed Toolbar is not being updated

This awesome jQuery plugin is developed by steveathon. For more Advanced Usages, please check the demo page or visit the official website.