HTML:

       <div>
              <!-- 加载编辑器的容器 -->
              <div ></div>
       </div>
              <input  />

JS:

//编辑器ID:editor     储存文本值ID:editortext
UE.Editor.prototype.placeholder = function (justPlainText) { var _editor = this; _editor.addListener("focus", function () { var localHtml = _editor.getPlainTxt(); if ($.trim(localHtml) === $.trim(justPlainText)) { _editor.setContent(""); } }); _editor.addListener("blur", function () { var localHtml = _editor.getContent(); if (!localHtml) { _editor.setContent('<p style="color: #CDCDCD">' + justPlainText + '</p>');//提示语字体灰色 //_editor.setContent(justPlainText);//提示语字体黑色 } }); _editor.ready(function () { _editor.fireEvent("blur"); }); }; //失去焦点,文本为空时,添加 UE.getEditor('编辑器ID').addListener('blur', function () { if ($("#储存文本值ID").val() == "") { //placeholder内容(只能是文本内容) editor.placeholder("请输入。。。。"); } }); //实例化编辑器example var editor = UE.getEditor('编辑器ID'); if ($("#储存文本值ID ").val() == "") { //placeholder内容(只能是文本内容) editor.placeholder("请输入。。。。"); }

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2021-11-01
  • 2021-10-24
  • 2021-07-31
  • 2021-12-23
猜你喜欢
  • 2021-11-01
  • 2021-04-18
  • 2021-04-12
  • 2022-12-23
  • 2021-11-01
  • 2021-07-24
相关资源
相似解决方案