Last active
September 21, 2015 14:06
-
-
Save A/b56b2d7310bc0b7df563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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