CKEDITOR : storing wordcount value to a variable

为君一笑 提交于 2019-12-12 03:41:25

问题


CKEDITOR: I have a form and a textarea(replaced to ckeditor) if i pass the content of the textarea how do i get the wordcount value ? i am using the wordcount plugin in ckeditor. thank you

//how do i store the wordcount?
CKEDITOR.replace('textarea', {
  extraPlugins: 'wordcount,justify'
});
//how do i get the wordcount ?
<?=  form_input($title,set_value('title')) . "</br>"; ?>
  <textarea name="textarea" id="text" required></textarea>
  <?= form_close(); ?>

    //in php $text = $this->input->post('textarea'); //$textwordcount = wordcount of the textarea;

回答1:


maybe you can use my trick

$text = strip_tags($this->input->post('textarea'));
$words = count(explode(' ',$text));


来源:https://stackoverflow.com/questions/43359720/ckeditor-storing-wordcount-value-to-a-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!