开发者

django jquery admin problems

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]


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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜