Groups
Groups
Sign in
Groups
Groups
Prototype & script.aculo.us
Conversations
About
Send feedback
Help
$$, the each function and binding
0 views
Skip to first unread message
Abbas
unread,
Nov 5, 2009, 5:37:38 AM
11/5/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prototype & script.aculo.us
Hi,
I encountered a scenario wherin if i do
$$(some selector).each(function(node){
someFunction(node, this)
}).bind(this)
, the 'this' object within someFunction() is not the original context
that i bound the 'each' function to.
Can you please explain?
Thanks
T.J. Crowder
unread,
Nov 6, 2009, 8:45:26 AM
11/6/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prototype & script.aculo.us
Hi,
You're calling #bind on the return value from #each, which is
incorrect -- #each returns the enumerable object, which doesn't have a
#bind method.
What you're looking for is the second _parameter_ to #each, details in
the docs[1].
[1]
http://api.prototypejs.org/language/enumerable.html#each-instance_method
HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com
Reply all
Reply to author
Forward
0 new messages