Skip to content

Instantly share code, notes, and snippets.

@alexgb
Last active December 28, 2015 03:19
Show Gist options
  • Save alexgb/7434182 to your computer and use it in GitHub Desktop.
Save alexgb/7434182 to your computer and use it in GitHub Desktop.
Enter lorem ipsum into focussed input
$.ajax('https://baconipsum.com/api/?type=all-meat&sentences=3').then(function(results) {
var el = $(':focus');
var letters = results[0].split('');
el.val('');
var timeout = window.setInterval(function() {
var letter = letters.shift();
if (letters.length === 0) {
window.clearTimeout(timeout);
}
el.val(el.val() + letter);
}, 20);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment