ホームページ  >  記事  >  バックエンド開発  >  php で kindeditor プラグインを使用する場合、js を使用してコンテンツを取得できません。

php で kindeditor プラグインを使用する場合、js を使用してコンテンツを取得できません。

WBOY
WBOYオリジナル
2016-06-23 13:23:401146ブラウズ

以上です。kindeditor を Smarty プラグインにカプセル化し、876e31c48fa2b1ba7dca19e1bde80ec8 を使用して別のページに導入しました。

プラグイン: function.html_kindeditor.php

<?phpfunction smarty_function_html_kindeditor(){    $editor1='        <script type="text/javascript">        var editor1;		KindEditor.ready(function(K) {			var editor1 = K.create(\'textarea[name="content1"]\', {				cssPath : \'/wxy/view/plugins/code/prettify.css\',				uploadJson : \'/wxy/view/upload_json.php\',				fileManagerJson : \'/wxy/view/php/file_manager_json.php\',				allowFileManager : true			});			prettyPrint();		});	</script>		<textarea name="content1" style="width:700px;height:200px;" id="content1"></textarea>	       <input type="button" value="提交" id="subContents"/> ';    return $editor1;}


導入する必要がある別のテンプレートは次のとおりです: a.html
//jquery代码		$("#subContents").click(function(){			 alert("字符串长度:"+($("#content1").val()).length+"类型:"+(typeof $("#content1").val()));		});

文字列を入力した後、長さは 0 になり、判定は文字列になります



ディスカッションに返信 (解決策)

allowFileManager : true,						afterBlur:function(){ 							this.sync(); 						}

試してください...

allowFileManager : true,						afterBlur:function(){ 							this.sync(); 						}

試してください...


それは本当に機能します、問題は解決されました。ははは。
声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。