Passing parameters to event handler functions

When coding in javascript, some people may wonder how to pass extra parameters to the event handler function. Here is a workaround hope can help you:
blow the example is coded using prototype

$(el).observe('click', function(e){ EVENT_HANDLER_FUNCTION(e, para1, para2, ...)})

I guess the example code is quite self-explaining, hope can help =)

Tagged with:

Recent Entries

2 Comments

  1. Jossan says:

    Thanks ming! I’ll definitely try this next time I’m using events in js..

Leave a Reply