【问题标题】:Onchange even t call with jQuery Text Editor使用 jQuery 文本编辑器调用 Onchange 事件
【发布时间】:2017-10-12 07:10:06
【问题描述】:

我的页面上的文本区域很少:

<div class='responsibilities'>
    <h2>The appraisee's responsibilities during the quarter:</h2>
    <textarea class='quartz_textarea' id='resp' name='resp'></textarea>    
</div>
<div class='strengths'>
    <h2>The appraisee's strengths and good qualities during the quarter:</h2>
    <textarea class='quartz_textarea' id='str' name='str'></textarea>
</div>
<div class='improve'>
    <h2>Areas in which the appraisee still has to improve:</h2>
    <textarea <?php class='quartz_textarea' id='impr' name='impr'></textarea>    
</div>
<div class='outlook '>
    <h2>Outlook on the next quarter:</h2>
    <textarea class='quartz_textarea' id='outlk' name='outlk'></textarea>    
</div>

我使用 jQuery 文本编辑器并希望在数据库中自动保存文本:

$(function () {
    $('.quartz_textarea').jqte();

    var timeoutId;
    $('textarea').on('input propertychange change', function() {
      console.log('Textarea Change');

      clearTimeout(timeoutId);
      timeoutId = setTimeout(function() {
        // Runs 1 second (1000 ms) after the last change    
        saveToDB();
      }, 1000);
    }); 
});

只有当我删除 $('.quartz_textarea').jqte(); 时它才有效,否则它不起作用。我该如何解决这个问题?

【问题讨论】:

  • 请注意,您有一些 PHP 开始标签 '

标签: jquery jqte


【解决方案1】:

您可能想在此处使用 jqye 更改回调

$('.quartz_textarea').jqte({change: function(){//Your code or function call comes here }});

你也可以使用

focus:
blur:

【讨论】:

    猜你喜欢
    • 2019-06-11
    • 1970-01-01
    • 2019-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多