我的页面上有几个textareas:
<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();
时它才有效,否则它不起作用。我该如何解决这个问题?
答案 0 :(得分:1)
你可能想在这里使用jqye更改回调
$('.quartz_textarea').jqte({change: function(){//Your code or function call comes here }});
你也可以使用
focus:
blur: