javascript - Dojo InlineEditBox 无法初始化

标签 javascript dojo

尝试使用 tutorial 中描述的 InlineEditBox .

代码未更改:

require(["dijit/InlineEditBox", "dijit/form/Textarea", "dojo/domReady!"], function(InlineEditBox, Textarea){
    var eb = new InlineEditBox({
        editor: Textarea,
        autoSave: false
    }, "ieb").startup();
});

由于某种原因,我遇到了一个错误:

TypeError: Cannot read property 'on' of null

运行调试器显示InlineEditBox从未初始化。例如。 new Button() 创建一个小部件,如控制台中所示,而 new InlineEditBox() 返回 null。

最佳答案

我创建了一个jsfiddle它按预期工作。

您能向我们展示您的 HTML 代码吗?

<body class="claro">
<div id="ieb">
    When you click on this div you'll be able to edit it (in plain text).
    The editor's size will initially match the size of the (original) text, but will expand/contract as you type.
</div>

<script>
require(["dijit/InlineEditBox", "dijit/form/Textarea", "dojo/domReady!"], function(InlineEditBox, Textarea){
    var eb = new InlineEditBox({
        editor: Textarea,
        autoSave: false
    }, "ieb").startup();
});
</script>
</body>

关于javascript - Dojo InlineEditBox 无法初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29049741/

相关文章:

javascript - HTML5 Canvas 闪烁文字?

jquery - 如何将外部 html 文件嵌入到当前 html 文件但没有 iframe 标签

javascript - Dojo Javascript 变量范围

javascript - Xpages:我们如何为客户端 JS 代码实现本地化?

java - Dojo JSON 回调总是返回错误

javascript - D3 : Repositioning Pie Chart Labels on Update

javascript - 将多个图表和表格导出为 1 个 PDF

javascript - Chrome 内容和后台脚本能否共享对 blob : URLs? 的访问权限

javascript - jQuery 更改背景颜色 CSS

python - 使用 Django 为 Dojo 的 JsonRestStore 实现 Restful 服务器 - 哪些工具适合这项工作?