问题
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