I’m willing! And since it’s completely different from the first answer:
You don’t need to use jQuery: use CSS3 and if you need to, Vanilla JS or its equivalent in jQuery:
Show text while textarea has focus no need for JS: (jsbin)
#showedText {
opacity: 0;
transition: opacity 1s 1s;
}
#myTextarea:focus + #showedText {
opacity: 1; transition-delay: 0;
}
Show text while textarea is being edited uses little JS: (jsbin)
#showedText {
opacity: 0;
transition: opacity 1s 1s;
}
#showedText.editing {
opacity: 1; transition-delay: 0;
}
Javascript utilizado - Vanilla JS:
var myTextarea = document.getElementById('myTextarea');
var showedText = document.getElementById('showedText');
myTextarea.addEventListener('keydown', function () {
showedText.className += ' editing ';
setTimeout(function () {
showedText.className = showedText.className
.replace(/(^|\b)editing(\b|$)/g, '');
}, 500);
});
Javascript utilizado - jQuery or Zepto:
var showedText = $('#showedText');
$('#myTextarea').on('keydown', function () {
showedText.addClass('editing');
setTimeout(function () {
showedText.removeClass('editing');
}, 500);
});
Editing: while I was writing this wall of code other people ventured into using CSS3, so I leave a hint to the author: prefix.
Warning: this issue has become a jQuery Golf Code. Who is willing to solve the problem without using jQuery!? (Tip: CSS3)
– Gustavo Rodrigues