How can I add a function reference to an object literal
Posted
by
rob
on Stack Overflow
See other posts from Stack Overflow
or by rob
Published on 2013-10-24T09:52:15Z
Indexed on
2013/10/24
9:53 UTC
Read the original article
Hit count: 199
I need to add binders to DOM elements after rendering is done. Therefore I want to pass a list with (ID, callback)
tuples to the rendering function so it can bind it after the rendering is done.
So i would like to create a list of such objects and pass it to the rendering function:
{id:'#someDOMelement', callback: someObject.someFunction}
and bind it after the rendering like this:
$(binders[i].id).bind('click', binders[i].callback);
© Stack Overflow or respective owner