$("body").trigger({
type:"logged",
user:"foo",
pass:"bar"
});
views:
71answers:
2What your code does is:
- Trigger an event called logged in the
document.bodyelement - pass user and pass to the event handler
I have no idea how to how to display that in "normal xhtml". Let's say we have defined a special event logged, this could be the handler
$(document.body).bind('logged', function(event, user, pass){
// event = event object
// user = foo
// pass = bar
});
The trigger method emulates an event occuring, there is no corresponding method in the standard DOM. To do the same without jQuery you would basically have to copy the code from jQuery (with reservations for any licence restrictions that would make this illegal).
I'm not sure what your example would really do, as it doesn't follow the syntax in the documentation. According to that, the trigger method needs an event name, and optionally an array of parameters:
If the event handler doesn't need the use of the environment of the event, you could just call it as a method:
body.someEventName(param1, param2);
However, your example is using custom properties in the event object, so it won't work for that exact case.