Javascript 就地编辑问题
我想为一些东西创建就地编辑,我想从创建一个可以编辑文本的div开始。。。但我面临一个问题:Javascript 就地编辑问题,javascript,html,dojo,Javascript,Html,Dojo,我想为一些东西创建就地编辑,我想从创建一个可以编辑文本的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.creat
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");
我做错了什么?或者我错过了什么
我一直在努力学习本教程:
先谢谢你。。。dojo新手
编辑:
似乎它进入了inlineeditbox.js并在这一行中断:this.displayNode.setAttribute(“角色”、“按钮”)代码>尝试:
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();
});
是newtextarea();一个dojo的东西还是一个错误?喂。。这是一个道场,我不好。我们在这里看到很多垃圾,上次我检查时,dojo使用了名称空间。我想我不是最新的五年前的javascript怪物,从来没有去任何地方…嗨,我找到了解决方案。它的id是“ieb”。。。相反,我需要用节点重播“ieb”。这就成功了。无论如何,谢谢你:)