What it does, it checks if no length in input area refresh with no text,
then if there is value show text, then also on keydown check. show
text, and a extra refresh when a long time has past after key up,
also a timeout for extra, just if someone has a value for way to long..
if you have any tips and tricks to do this better please let me know!
if not now you have now enjoy!

Code: Select all
if( $('#usermsg').val().length === 0) {
var refreshIT = setInterval(function() {
$('#container').text('');
}, 10000);
};
if( $('#usermsg').val().length === 1) {
$('#container').text('user is typing..');
};
$('#usermsg').keydown(function(){
$('#container').text('user is typing..');
setTimeout(update(),100000);
});
$("#submitmsg").click(function() {
$('#container').text('');
});
$('#usermsg').keyup(function(){
var refreshIT = setInterval(function() {
$('#container').text('');
}, 1000000);
});
function update() {
var refreshIT = setInterval(function() {
$('#container').text('');
}, 10000);
};