>  기사  >  백엔드 개발  >  php下使用kindeditor插件,用js始终获取不到内容,。

php下使用kindeditor插件,用js始终获取不到内容,。

WBOY
WBOY원래의
2016-06-23 13:23:401146검색

是这样的,我把kindeditor封装到了smarty的插件,在另外一个页面中使用引入。

插件: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,判断是string



回复讨论(解决方案)

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

试试...

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

试试...


还真行,问题解决了。哈哈。
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.