Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
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:


What I have tried:

JavaScript
 $(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);
            }
        });
        });


aspx:
<ckeditor:ckeditorcontrol id="CKEditor1" basepath="~/ckeditor/" runat="server" width="940px" height="400px">


C#
<pre lang="C#">here, this.selectionStart is undefined, here how can i call the this.selectionStart ?

TIA</pre>
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900