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 09-21-2009, 10:22 AM   PM User | #1
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
enter activate function

Hello all i have the following:

Code:
$(document).ready(function(){
	$("#getInfo").bind("click", function(){
		var keyword = $("#keyword").val();
		$("#content").html('Gathering data... <img src="loader.gif" />'); 
		$.ajax({
			type: "GET", 
			data: 'keyword=' + keyword, 
			url: 'proccess.php', 
			cache: false,  
			error: function(html){
				$("#content").html(
				"<span class=\"red\">Error: Network connection low, please try again later.</span>" + html
			);},  
			success: 
			function(html){
				$("#content").html(html);				
			}
		});
	});
});
setTimeout(ready, 500000);
When a button is clicked, away it goes. But if you type info in the input box, and press enter, obviously nothing happens. how do i activate function when data is inserted and then enter is pressed?
Phil Jackson is offline   Reply With Quote
Old 09-21-2009, 01:24 PM   PM User | #2
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
no? nobody?
__________________
Website Design Mansfield
PHP Code:
function I_LOVE(){function b(&$b='P'){$b.='P';}function a($_){return $_++;}$b='P';define("B",'H');b($b=implode('',array($b=a($b),$b=a(B))));b($b);return $b;}
echo 
I_LOVE(); 
Phil Jackson is offline   Reply With Quote
Old 09-21-2009, 04:20 PM   PM User | #3
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
Code:
$("#keyword").keyup(function(e) {
	if(e.keyCode == 13) {

		// do stuff


		//and stop Enter submitting the form
		e.preventDefault();
		return false;
	}
});
Spudhead is offline   Reply With Quote
Reply

Bookmarks

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 07:32 AM.


Advertisement
Log in to turn off these ads.