[jQuery] Re: A Syntax question/problem

2009-10-26 Thread cdukes77
Both answers are excellent. Two different approaches, both teach me something new. Thank you both Chip

[jQuery] Re: A Syntax question/problem

2009-10-26 Thread brian
I can't believe that I didn't notice that. On Mon, Oct 26, 2009 at 11:58 AM, Michel Belleville wrote: > Forms already submit when the enter is pressed, though they can also submit > when an input submit button is pressed. Binding the ajax call to the submit > events covers both scenarios, plus i

[jQuery] Re: A Syntax question/problem

2009-10-26 Thread Michel Belleville
Forms already submit when the enter is pressed, though they can also submit when an input submit button is pressed. Binding the ajax call to the submit events covers both scenarios, plus it seems to me a lot less complicated than catching the key13 event. Michel Belleville 2009/10/26 brian > >

[jQuery] Re: A Syntax question/problem

2009-10-26 Thread Michel Belleville
Forget about catching the enter key press, catch the form submit instead, make it do the ajax call and prevent default response, and execute the same ajax call on change : var ajax_search = function() { // whatever AJAX you want ... }; $('#search').change(function(event) { ajax_search(); }) .clos

[jQuery] Re: A Syntax question/problem

2009-10-26 Thread brian
Maybe something like this? $("#search").change(doSearch($(this))).bind("keypress", function(e) { if (e.keyCode == 13) { doSearch($(this)); return false; } }); function doSearch(el) { var vKeyword = el.val; $.ajax({ type: "GET", ... On Sun, Oct 25