【问题标题】:How to display alert message while typing inside CKEditor? Using javascript/c# in an ASP.NET Web application在 CKEditor 中输入时如何显示警报消息?在 ASP.NET Web 应用程序中使用 javascript/c#
【发布时间】:2016-10-03 08:14:32
【问题描述】:
<div>
    <CKEditor:CKEditorControl ID="CKEditor1" BasePath="~/ckeditor/" runat="server" Width="1108px" Height="383px"></CKEditor:CKEditorControl>
</div>
<script  type = "text/javascript">
             $(document).ready(function () {
                 CKEDITOR.on('instanceCreated', function (e) {
                     e.editor.on('contentDom', function () {
                         e.editor.document.on('keydown', function (event) {

                                 if (event.data.$.keyCode == 97) {
                                    alert('Key Pressed');
                                 }                           

                             });                     

                     });
                 });

             });

    </script>

上面的代码我尝试过但无法正常工作。如果有人知道,请分享。 在 CKEditor 中输入时如何显示警报消息?在 ASP.NET Web 应用程序中使用 javascript/c#。

【问题讨论】:

  • 函数被调用了吗?

标签: javascript c# css ckeditor


【解决方案1】:

您的问题是选择的事件。使用key 而不是keydownHere 是一个可行的小提琴示例。

CKEDITOR.instances.yourtextareaid.on('key', function (event) {
                                //press a to see this working
                                 if (event.data.keyCode == 65) {
                                    alert('Key Pressed');
                                 }                           
                             });

【讨论】:

  • 我不确定,对于那个例子你可以看到那是 4.2 版本。您在触发事件时遇到问题吗?
  • 很高兴为您提供帮助!也请将此标记为正确答案。它可能会在未来帮助其他人:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-13
  • 2012-03-11
  • 2017-12-19
  • 1970-01-01
  • 1970-01-01
  • 2013-01-22
相关资源
最近更新 更多