handler - Cant handle it (jQuery hanlder understanding needed) -


I am ashamed to ask too but someone can help me to understand what is "handler" And the API is consistently the same as the following:

  toggle (handbags), handler (event object), [handler (event object)])  

I scratched my head and told myself "hell is a handler" Then I check my 2 jquery books and there Not see anything Stw. What I get is an event handler, it handles an event but in the above reference, the word handler includes "Event Object". I tried to google it, but actually did not really get a clear definition that what exactly is a handler because it is related to jquery thanks to your help =]

Think of any handler for whatever operation is being done as a callback. In the case of handler (event object) , this means that the method to be taken with that parameter can accept it and that function, before, during or during the time of some specific point Will be called in the execution of the way it is received (as shown by the parameter specification) and this value will be passed to a value called event object, which can be anything but the maximum There is a possibility that the goal of the event issued for your callback.

Here is an example:

  function microbe (event object) {warning (jQuery (event object) .attr ('id') + 'toggled')); } Click JQuery ("# ​​myBtn") (function () {jQuery ("# ​​myObj") Toggle ("Fast", Function (Event Object) {MyCallback (eventObject);})}};   

With the above code, when #myBtn is clicked, the element will be toggled on #myObj (faster) and as soon as Toggle animation is completed MyCallback will be called and passed to #myObj , which will show a warning, "myObj toggled".


Comments