In my application i am using Ckeditor, by default ckeditor first letter is not capital, So i need to convert first letter to upper case, that is automatically change lower to upper, for that i am using jquery Keyup event, and i tried with below code:
$(document).ready(function () { CKEDITOR.on('instanceCreated', function (e) { e.editor.on('contentDom', function () { e.editor.document.on('keyup', function (event) { if (this.selectionStart == 0 && event.data.$.keyCode >= 65 && event.data.$.keyCode <= 90 && !(event.data.$.shiftKey) && !(event.data.$.ctrlKey) && !(event.data.$.metaKey) && !(event.data.$.altKey)) { var $t = $(this); event.data.$.preventDefault(); var char = String.fromCharCode(event.data.$.keyCode); $t.val(char + $t.val().slice(this.selectionEnd)); this.setSelectionRange(1,1); } }); });
and aspx code is:
<CKEditor:CKEditorControl ID="CKEditor1" BasePath="~/ckeditor/" runat="server" Width="940px" Height="400px"></CKEditor:CKEditorControl>
here, this.selectionStart is undefined, here how can i call the this.selectionStart ?
TIA