ASP CKEditorControl's content length on client-side

南笙酒味 提交于 2019-12-25 00:29:43

问题


I'm using CKEditor in my ASP.NET webforms application. I'm using CKEditor control to put it to my page:

<CKEditor:CKEditorControl ID="CKEditorControl" runat="server" />

But I'd like to get the editor's content length on client-side. I'm trying to do it this way:

CKEDITOR.instances['<%= CKEditorControl.ClientID %>'].getData().length;

Though it's not working because: "Uncaught TypeError: Cannot call method 'getData' of undefined"

So my question is. What am I doing wrong? And is it possible to get the CKEditor's length on client-side when using CKEditorControl?


回答1:


this code works:

$('#cke_<%= CKEditorControl.ClientID %> iframe').contents().find('body').html()

I'm not sure now but I guess all my problems were because I was trying to get the data before the editor was loaded.



来源:https://stackoverflow.com/questions/6607713/asp-ckeditorcontrols-content-length-on-client-side

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!