ASP CKEditorControl在客户端的内容长度 [英] ASP CKEditorControl's content length on client-side
问题描述
我在我的ASP.NET webforms应用程序中使用CKEditor。我使用CKEditor控件将其放到我的页面:
&CK; CKEditor:CKEditorControl ID =CKEditorControlrunat =服务器/>
但我想在客户端获得编辑器的内容长度。我想这样做:
CKEDITOR.instances ['<%= CKEditorControl.ClientID%> ] .getData()。length;
虽然它不工作,因为:未捕获TypeError:不能调用未定义的方法'getData' p>
所以我的问题是。我做错了什么?
这段代码的工作原理:
这个代码可以在客户端获得CKEditor的长度 $('#cke_<%= CKEditorControl.ClientID%> iframe')。contents()。find('body')。html ()
我现在不知道,但我猜我的问题都是因为我想加载编辑器之前的数据。
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?
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.
这篇关于ASP CKEditorControl在客户端的内容长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!