Skip to content

Instantly share code, notes, and snippets.

@A
Last active September 21, 2015 14:06
Show Gist options
  • Save A/b56b2d7310bc0b7df563 to your computer and use it in GitHub Desktop.
Save A/b56b2d7310bc0b7df563 to your computer and use it in GitHub Desktop.
new Test('Hello World', 200); // try to change offset
function Test(str, offset) {
var i = 0;
var $search = $('.sel-search-input');
$search.val('').focus();
(function next() {
setTimeout(function() {
if (i >= str.length) return;
var e = $.Event('input', { keyCode: str.charCodeAt(i) });
var val = $search.val();
$search
.val(val + str[i])
.trigger(e)
;
i++;
next();
}, offset);
})();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment