简体   繁体   English

我们可以限制通过CKeditor输入的字符吗

[英]Can we put a limit for characters entered through CKeditor

I like to put a limit on character entered using ckeditor. 我想限制使用ckeditor输入的字符。 I used javascript to limit characters for textarea, But i am unable to limit character when ckeditor is used.i want only 3500 words to be entered using ckeditor afterwards a pop up should say i have reached the maximum limit,Is there any way of doing this??? 我使用javascript限制了textarea的字符,但是使用ckeditor时我无法限制字符。我只想使用ckeditor输入3500个字,然后弹出窗口应该说我已经达到了最大限制,有什么办法吗这个??? If ckeditor does'nt support this functionality , can someone refer any other editor please. 如果ckeditor不支持此功能,请有人可以参考其他任何编辑器。

You can simply truncate the string returned to the PHP script with substr (). 您可以使用substr()截断返回到PHP脚本的字符串。 If you need to truncate to a word count, then http://www.lullabot.com/articles/trim-a-string-to-a-given-word-count might be a good starting point (though it could use some refinement). 如果您需要截断字数,那么http://www.lullabot.com/articles/trim-a-string-to-a-given-word-count可能是一个不错的起点(尽管它可以使用一些细化)。

Doing it client-side would require a javascript plugin for the editor. 在客户端进行此操作需要编辑器使用JavaScript插件。 If this is the case then this isn't really a PHP question but a javascript question. 如果是这种情况,那么这实际上不是PHP问题,而是JavaScript问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我们如何在 PHP 中将字符串限制为给定数量的字符 - How can we limit a string to a given number of characters in Php 是否有一些代码可用于过滤字符串以将转义字符放在无效的MySQL字符之前? - Is there some code that I can use to filter through strings to put escape characters in front of invalid MySQL characters? 我们可以将ckeditor数据保存到doc文件中吗 - Can we save ckeditor data into doc file 我们可以限制 for 循环中的 if 条件吗? - Can we limit the if condition in for loop? 我们如何通过facebook Api使用sendRequestViaMultiFriendSelector限制发送请求 - how we can limit the send requests using sendRequestViaMultiFriendSelector through facebook Api ckeditor如何打开“图像属性”窗口? - ckeditor how can we open Image Properties window? 如何通过 5 个字符的 HTML 形式限制我的用户输入,以大写 S 开头,后跟四个数字? - How can I limit my user input through a HTML form of 5 characters, starts with an uppercase S and is followed with four numbers? 如何限制摘录中的字符数? - How can I limit the number of characters in an excerpt? 我们可以在jQuery代码中放入php吗? - Can we put php in jquery code? 无法在MYSQL中放置土耳其语字符 - Can't put Turkish characters in MYSQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM