开发者

How to get a value from Dijit.Editor?

开发者 https://www.devze.com 2022-12-22 11:14 出处:网络
I have a dijit.editor on my page and when I click on a button I want the contents inside my editor. It should be fairly simple, but I\'ve stumbled upon it for now.

I have a dijit.editor on my page and when I click on a button I want the contents inside my editor. It should be fairly simple, but I've stumbled upon it for now.

Never mind, i solved it.

   dojo.require("dijit.Editor");

  dojo.addOnLoad(function() {
      var editor = dijit.byId("myEditor");
      var btn1 = dojo.byId("Button1");

      editor.attr("value", "Hej igen"); 
      editor.onLoadDeferred.addCallback(f开发者_如何转开发unction() {
          editor.atte("value", "<b>This is new content.</b>");
      });

      btn1.onclick = function() {
          //  alert(editor.domNode.innerHTML);
      alert(editor.attr("value"));
      }

  });


As marko has pointed out, you can get the value by:

editor.attr("value")
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号