主题: 4.1.10能动态加载吗?
作者: diypyh, 发布日期: 2014-02-06 17:10:12, 浏览数: 2353

我的项目是在点击按钮后弹出一个DIV层,然后在这个层里加载KE,但是加载失败,这是我的代码,哪里有问题呢?


                                function() {
					var form = "";
					
					form += "<form class=\"form-horizontal\" role=\"form\">";

					form += "<div class=\"form-group\">";
					form += "<label class=\"col-sm-2 control-label no-padding-right\" for=\"form-field-article-content\"> 内容</label>";
					form += "<div class=\"col-sm-10\">";
					form += "<textarea style=\"width:700px;height:200px;visibility:hidden;\" id=\"form-field-article-content\"></textarea>";
					form += "</div>";
					form += "</div>";

					form += "</form>";
					
					bootbox.dialog({
						message: form,
						buttons: 			
						{
							"success" :
							 {
								"label" : "<i class='icon-ok'></i> 增加",
								"className" : "btn-sm btn-success",
								"callback": function() {
									console.info("点击了增加");
								}
							},
							"button" :
							{
								"label" : "取消",
								"className" : "btn-sm"
							}
						}
					});
					
					// 弹出DIV层后再执行以下代码
					var editor;
					KindEditor.ready(function(K) {
						editor = K.create('#form-field-article-content', {
							resizeType : 1,
							allowPreviewEmoticons : false,
							allowImageUpload : false,
							afterBlur:function(){this.sync();}, 
							items : [
								'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
								'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
								'insertunorderedlist', '|', 'emoticons', 'image', 'link']
						});
					});
				}
作者: Jerome, 发布日期: 2014-02-08 10:00:56

可以,你用了Jquery就这样写

 

 $().ready(function() {

           

             var editor = KindEditor.create('#Content', {

 

            });

});

回复
作者: Geek微动力, 发布日期: 2014-02-26 16:20:07
顶起...我也想知道能否动态加载,就是我动态加div,然后针对这新加的div初始化成编辑器...
回复
发表新帖 发表回复