[英]How to display alert message while typing inside CKEditor? Using javascript/c# in an ASP.NET Web application
<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#。
您的問題是選擇的事件。 使用key
而不是keydown
。 這是一個有效的小提琴示例。
CKEDITOR.instances.yourtextareaid.on('key', function (event) {
//press a to see this working
if (event.data.keyCode == 65) {
alert('Key Pressed');
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.