Jqury - Check if user is typing in input.

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
UnknownUser
Posts: 51
Joined: Tue Sep 08, 2009 2:54 pm

Jqury - Check if user is typing in input.

Post 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);
  };
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English. ~Author Unknown
User avatar
UnknownUser
Posts: 51
Joined: Tue Sep 08, 2009 2:54 pm

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

Post 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!
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English. ~Author Unknown
Post Reply

Return to “General Development”