Page 1 of 1

Jqury - Check if user is typing in input.

Posted: Sat May 05, 2012 5:55 pm
by UnknownUser
Hey guys, i'm looking into if there is a better way to do this, let me know please!

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! :D

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);
  };

Re: Jqury - Check if user is typing in input.

Posted: Sat May 05, 2012 6:47 pm
by UnknownUser
now i just have to figure out how to show it to all who is in the chat :/
forgot to fix that lol!, np fixing it now!