$(document).ready(function(){
var keyUpTime = 0;
var t = 0;
var executeAfterOneSecond = false;
$('#source').keyup(function(){
if(executeAfterOneSecond == false){
executeAfterOneSecond = true;
t = setTimeout(function(){
executeAfterOneSecond = false;
sendValue($('#source').val());
}, 600);
}
keyUpTime = $.now();
setTimeout(function(){
if($.now() - keyUpTime >= 200) {
clearTimeout(t);
executeAfterOneSecond = false;
sendValue($('#source').val());
}
},200);
});
});
<textarea id="source" name="text" wrap="soft" tabindex="0" dir="ltr" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off" style="box-sizing: border-box; overflow-y: hidden; overflow-x: auto; padding-right: 20px; " class="oggy-textarea">
</textarea>
さて、私のコードが change(); で動作することを望みます。[$('#source').change(function(){---});]、keyup() ではありませんが、そうではありません。bind() で試しましたが、何もしませんでした。どうしたの?