Last active
December 28, 2015 03:19
-
-
Save alexgb/7434182 to your computer and use it in GitHub Desktop.
Enter lorem ipsum into focussed input
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
$.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