我想为一些东西创建就地编辑,我想从创建一个包含文本的div开始,它可以被编辑.但我面临一个问题:
Uncaught TypeError: Cannot call method 'setAttribute' of null 这是我的代码:
var node = dojo.createElement("div");
node.setAttribute("id", "ieb");
var area = new Textarea();
var newContent = document.createTextNode("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.");
node.appendChild(newContent);
var eb = new InlineEditBox({
editor: area,
autoSave: false
}, "ieb");我在这里做错什么了?或者我错过了什么?
我试着用本教程来做一个长时间的学习:http://dojotoolkit.org/reference-guide/1.9/dijit/InlineEditBox.html
提前谢谢..。新来的道场。
编辑:似乎要进入inlineeditbox.js,并突破了这一行:this.displayNode.setAttribute("role", "button");
发布于 2013-07-24 22:39:55
尝试:
require(["dojo", "dijit/InlineEditBox", "dijit/form/Textarea"], function (dojo, Textarea, InlineEditBox) {
var node = dojo.create("div", {
id: "ieb",
innerHTML: "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 ty"
}, dojo.body());
var eb = new InlineEditBox({
editor: Textarea,
autoSave: false
}, "ieb");
eb.startup();
});https://stackoverflow.com/questions/17845097
复制相似问题