2

I have added tinyMCE to my django admin which works fine but now I am getting errors showing up in firebug:

django is not defined [Break on this error] })(django.jQuery);

This is my custom code: [code] {% extends "admin/change_form.html" %}

{% block extrahead %}

$(document).ready(function() { tinyMCE.init({ mode : "textareas", theme : "advanced" //(n.b. no trailing comma, this will be critical as you experiment later) }); });

{% endblock %} [/code]

1 Answer 1

3

The jQuery version included in Django's admin lives in a separate namespace.

So either replace each call of $ in your script by django.jQuery, or make the $ variable available in the scope by wrapping your code like this:

(function($) {
    $(document).ready(function() {
        tinyMCE.init({mode: "textareas", theme: "advanced"});
    });
}(django.jQuery));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.