File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 641
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: 61756
    
  67

$(".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: 641
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: 61756
    
  67

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

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

-P
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jquery:- binding the function