This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes jQuery Equivalent of Prototype Function.bind  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery Equivalent of Prototype Function.bind  " Watch "jQuery Equivalent of Prototype Function.bind  " New topic
Author

jQuery Equivalent of Prototype Function.bind

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
Is there a jQuery way of doing this Prototype bind?




Thanks.

BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Use a closure



Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61450
    
  67

Remember that the purpose of Prototype is to make JavaScript as OO as possible, while jQuery uses JavaScript as itself. As such, Prototype defined .bind() to allow people to not have to really learn how JavaScript works (and thus avoid closures).

While that may have some appeal to some folks, I think it quickly becomes very limiting.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
Thanks Eric. closure is cool.
Thanks for the book Ajax In Action too. I have both editions. Any new version?
Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61450
    
  67

Bruce Jin wrote:Thanks for the book Ajax In Action too. I have both editions. Any new version?

Ajax in Action only has a single edition. At one time, Manning planned for a 2nd edition, but there are no current plans for a second.
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
Thanks bear.
I messed up Ajax in Practice with Ajax in Action 2. Thanks for been the author!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
No plans on Ajax In Action 2nd ed. we talked about it, but choose not too after long discussions.

I am working on two separate projects now. TOP SECRET.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery Equivalent of Prototype Function.bind