【问题标题】:jeditable placeholder issue可编辑的占位符问题
【发布时间】:2011-11-19 12:26:23
【问题描述】:

我正在使用 jeditable,占位符是文本。我试图让它在我编辑框后占位符是我输入的文本。不是实际文本“点击编辑” 在您编辑输入框“如果你敢点击我”后,在演示网站上,它将显示您输入的内容。我复制了 js 并使用了它,但它的行为并非如此。任何提示/指导将不胜感激。 (字段名称为 notes 并使用 sql 语句提取。save.php 对同一字段执行 UPDATE。)

演示:http://www.appelsiini.net/projects/jeditable/default.html
jeditable.js:

http://www.appelsiini.net/download/jquery.jeditable.js

var e = jQuery.noConflict();
  e(".click" + zid).editable("http://www.site.com/save.php", { 
        id   : 'did',
         name : 'nvalue',
      indicator :  'Saving...',
      tooltip   : "Click to add/edit notes",
      style  : "inherit",
      width      : '630px',
      onblur     : 'submit',
     placeholder: 'click to edit',
      type   : "textarea"
  });

【问题讨论】:

    标签: php jquery jeditable


    【解决方案1】:

    您的保存脚本必须回显您要在网页上显示的字符串。如果保存脚本没有返回任何内容,Jeditable 会显示默认占位符。

    【讨论】:

      【解决方案2】:

      这个例子可能会有所帮助:

      <?
      //$error is an array that stores previous validation errors
      //$id and $value contains default jeditable's $_POST values
      //so, if no errors found...
      if(count($error)<=0){
          //save
          $query = mysql_query( "UPDATE {$table} SET {$field}='{$value}' WHERE id='{$id}'");
          //print value so it displays/updates
          print $value;
      }else{
          //Errors found, here i just echo each one of them, then I can use jeditables's
          //"onerror:" callback to display or do stuff...
          header("HTTP/1.1 406 Error");
          foreach($error as $err){
              echo $err.' - ';
          }
      }
      ?>
      

      干杯!

      【讨论】:

        猜你喜欢
        • 2016-08-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-25
        • 1970-01-01
        相关资源
        最近更新 更多