我的页面上有几个文本区域:
<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();
否则它不起作用。我怎样才能解决这个问题?