尝试使用 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/