$("description").observe('keyup', function(event){
> text_counter(500).bind(this); });


 $("description").observe('keyup', text_counter.bind(this, 500));

Notice that in your example you're actual event handler is the anonymous
function, which calls text_counter. In the fixed up version we skip that
layer since it's not needed and simply make text_counter be the even

Also, just focusing in on how you are trying to use .bind(), please look at
this line:


Now think about what that is actually doing. You're saying "execute
text_counter(500), and then bind the results of that execution". Compare
that to the following...

text_counter.bind(this, 500)

Note the difference. .bind() is meant to be called on a function instance,
i.e. not the results of the function execution (unless your function returns
another function as a sort of factory pattern, but that's a whole other

Make sure you take a look at the API docs at too.

Ryan Gahl
Nth Penguin, LLC
Inquire: 1-920-574-2218
LinkedIn Profile:

On Wed, Apr 8, 2009 at 3:12 PM, bejitto101 <> wrote:

> $("description").observe('keyup', function(event){ text_counter
> (500).bind(this); });

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to