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.
Example:
$("p").trigger("click")
HTML:
<p click="alert('hello')">Hello</p>
Result:
alert('hello')
No comments:
Post a Comment