Skip to content

Instantly share code, notes, and snippets.

@ducdhm
Last active August 29, 2015 13:56

Revisions

  1. ducdhm revised this gist Feb 27, 2014. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions example.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    $('#query').keydown2(function () {
    console.log($(this).val());
    });
  2. ducdhm revised this gist Feb 27, 2014. 1 changed file with 13 additions and 13 deletions.
    26 changes: 13 additions & 13 deletions keydown2.jquery.js
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,14 @@
    (function ($) {
    $.fn.keydown2 = function (callback) {
    return $(this).each(function () {
    var control = $(this);
    control.keydown(function () {
    setTimeout(function () {
    callback.call(control, callback);
    }, 0);
    });
    });
    (function($) {
    $.fn.keydown2 = function(callback) {
    return $(this).each(function() {
    var control = $(this);

    control.keydown(function() {
    setTimeout(function() {
    callback.call(control, callback);
    }, 0);
    });
    });
    };
    })(jQuery);

    })(jQuery);
  3. ducdhm created this gist Feb 27, 2014.
    14 changes: 14 additions & 0 deletions keydown2.jquery.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    (function ($) {
    $.fn.keydown2 = function (callback) {
    return $(this).each(function () {
    var control = $(this);

    control.keydown(function () {
    setTimeout(function () {
    callback.call(control, callback);
    }, 0);
    });
    });
    };

    })(jQuery);