Change $("description").observe('keyup', function(event){ > text_counter(500).bind(this); });
To... $("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 handler. Also, just focusing in on how you are trying to use .bind(), please look at this line: text_counter(500).bind(this) 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 topic). Make sure you take a look at the API docs at prototypejs.org too. Ryan Gahl CEO Nth Penguin, LLC http://www.nthpenguin.com -- Inquire: 1-920-574-2218 Blog: http://www.someElement.com LinkedIn Profile: http://www.linkedin.com/in/ryangahl On Wed, Apr 8, 2009 at 3:12 PM, bejitto101 <bejitto...@gmail.com> wrote: > $("description").observe('keyup', function(event){ text_counter > (500).bind(this); }); > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---