<body> <form action="${ctx}/save.do" id="ueform" method="post"> <input id="editorValue" value="${bean.content}" type="hidden" /> <div style="width: 99%;"> <script id="infoEditor" type="text/plain" style="width:100%;"></script> </div> </form> </body>
form提交
function save(){ var content= UE.getEditor('infoEditor').getContent(); content = content.replace(new RegExp("<","g"),"<").replace(new RegExp(">","g"),">").replace(new RegExp("\"","g"),"""); $("#editorValue").val(content); $("#ueform").submit(); }
回显
getJson请求数据: $("#editorValue").html(data.content); 赋值: window.setTimeout( ue.ready(function() { //异步回调 UE.getEditor('infoEditor').execCommand('insertHtml', $('#testcon').html()); }) ,2000); var htmlStr = $("#editorValue").val(); //UE初始化后编辑框内容 ue.ready(function() { ue.execCommand('cleardoc');//清空 //回显内容 ue.setContent(htmlStr, false); ue.focus();//显示第一行 });