首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >就地编辑麻烦

就地编辑麻烦
EN

Stack Overflow用户
提问于 2013-07-24 21:25:57
回答 1查看 85关注 0票数 0

我想为一些东西创建就地编辑,我想从创建一个包含文本的div开始,它可以被编辑.但我面临一个问题:

代码语言:javascript
复制
Uncaught TypeError: Cannot call method 'setAttribute' of null 

这是我的代码:

代码语言:javascript
复制
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");

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-07-24 22:39:55

尝试:

代码语言:javascript
复制
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();
 });
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17845097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档