Skip to content

Instantly share code, notes, and snippets.

@Guley
Created June 8, 2018 10:09
Show Gist options
  • Save Guley/c57e734aeb15324fd20cd6cd115cfe31 to your computer and use it in GitHub Desktop.
Save Guley/c57e734aeb15324fd20cd6cd115cfe31 to your computer and use it in GitHub Desktop.
Use ckeditor for multiple texarea on same page
<textarea class="form-control category_content" name="category_content[1]" id="desc_1" required>
<textarea class="form-control category_content" name="category_content[2]" id="desc_2" required>
<textarea class="form-control category_content" name="category_content[3]" id="desc_3" required>
$('.category_content').each(function(e){
CKEDITOR.replace( $(this).attr('id'), {
height: '400px',
toolbar: [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
]
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment