Share via


Max Length with CKEditor

Question

Monday, February 28, 2011 2:02 AM

Hi,

 

i have used CkEditor in my site.

i want to implement max length o 1200 char on editor.

 requirement : 

1) as user types char it should show remaining char in decresing order.

2) as soon as user reaches max length editor should not allow to enter char anymore.

any prompt reply would be greatly appreciated.as i need to do it urgently.

 

All replies (4)

Monday, February 28, 2011 3:47 AM

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var TotalAllowed = 10;
        var remaining;
        $(document).ready(function() {
            $("#txtArticles").keydown(function() {
                remaining = TotalAllowed - $(this).val().length;
                if (remaining < 0) {
                    return false;
                }
                else {
                    $("#lblRemaingLetter").html(remaining);
                    return true;
                }
                
            })

        })
    </script>

    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:TextBox ID="txtArticles" TextMode="MultiLine" runat="server"></asp:TextBox>
    <span id="lblRemaingLetter"></span>
    </form>
</body>
</html>

Let me if some queries


Monday, February 28, 2011 4:50 AM

Thanks for your prompt reply, but above solutions seems for multiline text box, i have it already but i am looking for CKeditor max length.


Monday, February 28, 2011 5:08 AM

May these link help you.

http://www.rodi.nu/blog/2010/06/ckeditor-maximum-length/

http://sourceforge.net/tracker/index.php?func=detail&aid=1389555&group_id=75348&atid=737639


Thursday, March 3, 2011 12:15 AM

hi

i have tried above solution but it doesnt work.

can anyone else have solution?