V
V
Vitaly2017-04-14 10:40:30
JavaScript
Vitaly, 2017-04-14 10:40:30

Can't understand initContents__brief_body is not a function?

I have js code

if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
{
    CKEDITOR.tools.enableHtml5Elements( document );
}

CKEDITOR.config.height = '300px';
CKEDITOR.config.width = '100%';

var initContents__brief_body = ( function() {

    config = {
        "contentsCss" : ["/assets/d48a9ac3/css/bootstrap.css"]
    };

    var contents__brief_body = CKEDITOR.replace( 'contents-brief_body', config );
    } )();



initContents__brief_body()

in the console gives an error initContents__brief_body is not a function
Help me figure out what the problem is

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Luzanov, 2017-04-14
@kat-vetal

You write in initContents__brief_body the result of executing a self-invoking ( ) function that does not explicitly return anything (but returns undefined), therefore initContents__brief_body will be equal to undefined.(function() {})()

var initContents__brief_body = ( function() {

    config = {
        "contentsCss" : ["/assets/d48a9ac3/css/bootstrap.css"]
    };

    var contents__brief_body = CKEDITOR.replace( 'contents-brief_body', config );
    } )();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question