<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='docs.xsl'?>
<docs>
<method cat='Events' type='jQuery' short='Trigger a type of event on every matched element.' name='trigger'>
<desc>Trigger a type of event on every matched element. This will also cause
the default action of the browser with the same name (if one exists)
to be executed. For example, passing 'submit' to the trigger()
function will also cause the browser to submit the form. This
default action can be prevented by returning false from one of
the functions bound to the event.

You can also trigger custom events registered with bind.</desc>
<params type='String' name='type'>
<desc>An event type to trigger.</desc>
</params>
<params type='Array' name='data'>
<desc>(optional) Additional data to pass as arguments (after the event object) to the event handler</desc>
</params>
<examples>
<code>$("p").trigger("click")</code>
<result>alert('hello')</result>
<before>&lt;p click="alert('hello')"&gt;Hello&lt;/p&gt;</before>
</examples>
<examples>
<desc>Example of how to pass arbitrary data to an event</desc>
<code>$("p").click(function(event, a, b) {
  // when a normal click fires, a and b are undefined
  // for a trigger like below a refers too "foo" and b refers to "bar"
}).trigger("click", ["foo", "bar"]);</code>
</examples>
<examples>
<code>$("p").bind("myEvent",function(event,message1,message2) {
	alert(message1 + ' ' + message2);
});
$("p").trigger("myEvent",["Hello","World"]);</code>
<result>alert('Hello World') // One for each paragraph</result>
</examples>
</method></docs>
