zoukankan      html  css  js  c++  java
  • UEditor编辑器增加placeholder提示

    HTML:

           <div>
                  <!-- 加载编辑器的容器 -->
                  <div id="editor"  class="fls" style="815px;margin-bottom:10px"></div>
           </div>
                  <input id="editortext"   type="hidden" />

    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("请输入。。。。"); }

      

  • 相关阅读:
    验证控件没有向服务器发回数据
    立即窗口中体现回车换行
    初试发布功能
    文件内码不同造成的错误
    验证控件网页代码分析3
    VB自动把变量改成小写
    maven + eclipse + tomcat 实战JSP
    Java 多线程初探(一) 创建线程
    WebSocket简单使用(一) 概念
    JDBC的事务操作
  • 原文地址:https://www.cnblogs.com/yueyongsheng/p/12563979.html
Copyright © 2011-2022 走看看