This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes jquery:- binding the function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jquery:- binding the function" Watch "jquery:- binding the function" New topic
Author

jquery:- binding the function

Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 613
Hi,

I tried to bind keydown event on input with one function, but the second approach in code below does nothing on key down where as the first one triggers alert, what am i missing in second approach?



All desirable things in life are either illegal, banned, expensive or married to someone else !!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

$(".AutoComplete").bind("onkeydown",onAutoKeyDown);


"onkeydown"?

Think about it for a minute.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 613
shoot...got it working, that was so dumb

but the question i have , is $(input).keydown(somefunction) an alternate way to bind somefunction on keydown event?


-P
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Yes, for the frequently used event types, convenience methods are defined. They are entirely equivalent.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 613
cool, thanks again Bear.

-P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jquery:- binding the function
 
Similar Threads
jQuery HotKey - Handling more than two key combination
How to call jquery method in Struts.
JQuery, JSON and getting the selected value
JQuery Autocomplete Loading image
JQuery Autocomplete with ASP.Net webservice