Created
June 7, 2011 08:25
-
-
Save jdlrobson/1011894 to your computer and use it in GitHub Desktop.
Takes a textarea/input and deletes the text bit by bit
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
function clear(el) { | |
var interval = 300; | |
var charactersToRemove = 1; | |
var id = setInterval(function(ev) { | |
var x = $(el).val(); | |
if(!x) { | |
clearInterval(id); | |
} else { | |
var pos = x.length - charactersToRemove; | |
x = x.substr(0, pos); | |
$(el).val(x); | |
charactersToRemove *= 2 | |
} | |
}, interval); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment