title: jQuery delay on keyup
body: <p>I'm trying to implement <a href="https://stackoverflow.com/a/9686252/772437">this answer</a> in my own code:</p>
  
  <pre><code>$(document).ready(function() {
  
      $('#qty').delayKeyup(function() {
          var qty = $(this).val();
          $(this).val(Math.round(qty / 10) * 10);
      }, 1000);
  
  });
  
  (function ($) {
      $.fn.delayKeyup = function(callback, ms){
          var timer = 0;
          $(this).keyup(function(){
              clearTimeout (timer);
              timer = setTimeout(callback, ms);
          });
          return $(this);
      };
  })(jQuery);
  </code></pre>
  
  <p>but no change in the input value is occurring. If I remove the delayKeyup function the change works OK but obviously not with the delay. What am I missing?</p>