Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-26-2008, 01:02 PM   PM User | #1
papas
New Coder

 
Join Date: Nov 2005
Posts: 25
Thanks: 2
Thanked 0 Times in 0 Posts
papas is an unknown quantity at this point
jquery reading input value

Code:
  <script type="text/javascript">
	$(document).ready(function(){
		var __checkKey = null;
			$('#SearchAll').keypress(function(e){
				__checkKey = e.keyCode;
				__value = $(this).val();
				console.log(__value);
			})
	});
  </script>
i have an input box that would like to read the value of it whenever the user types something

the problem with the above code for example if i type

abc it will read ab
if i add d to abc to become abcd it will only read abc!
its driving me crazy any ideas???
papas is offline   Reply With Quote
Old 11-26-2008, 01:18 PM   PM User | #2
rangana
Senior Coder

 
rangana's Avatar
 
Join Date: Feb 2008
Location: Cebu City, Philippines
Posts: 1,752
Thanks: 65
Thanked 372 Times in 365 Posts
rangana will become famous soon enoughrangana will become famous soon enough
Use keyup instead:
Code:
$('#SearchAll').keypress(function(e){
Hope that helps.
__________________
Learn how to javascript at 02geek

The more you learn, the more you'll realize there's much more to learn
Ray.ph
rangana is offline   Reply With Quote
Old 11-26-2008, 03:57 PM   PM User | #3
papas
New Coder

 
Join Date: Nov 2005
Posts: 25
Thanks: 2
Thanked 0 Times in 0 Posts
papas is an unknown quantity at this point
thank you very much it worked!!!
papas is offline   Reply With Quote
Reply

Bookmarks

Tags
input, jquery, values

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:51 PM.


Advertisement
Log in to turn off these ads.