kindeditor在光标处插入编辑器外的数据

页面

               <div class="form-group clearfix">
<label class="control-label col-sm-3 col-md-3 col-lg-3 m-from-fon1" for="userName">用户</label>
<div class="col-sm-9 col-md-6 col-lg-6">
<input id="userName" name="userName" class="form-control dddd" type="button" value="用户名"/>
<input id="email" name="email" class="form-control dddd" type="button" value="邮箱"/>
</div>
</div>

js

$(document).ready(function () {

    buildEditor();
$(".dddd").on("click",function(){
//alert($(this).context.name); 拿到name
var startOffset = contentEditor.cmd.range.startOffset;//kindEditor中当前光标的位置索引值startOffset
contentEditor.insertHtml('<strong>${'+$(this).context.name+'}</strong>');//js插入指定的HTML内容到光标处。
});
}); var contentEditor; function buildEditor() {
KindEditor.ready(function (K) {
contentEditor = K.create('#content', KindEditor.buildOption('/kindeditor/upload.html', 'attachFile'));
}); }
上一篇:十分钟搞定微信企业帐号“echostr校验失败,请您检查是否正确解密并输出明文echostr”


下一篇:计划参照mysql-proxy编写mssql-proxy