How to implement debounce fn into jQuery keyup event?

Use it like this:-

$('input').keyup(debounce(function(){
    var $this=$(this);
    //alert( $this.val() );
    var n1 = $this.val();
    var n2 = $('#n2').val();
    var n3 = $('#n3').val();
    var calc = n1 * n2 * n3;
    alert(calc);
},500));

Fiddle

Leave a Comment