tags:

views:

43

answers:

1

The Jquery documentation says:

"Triggered events aren't limited to browser-based events, you can also trigger custom events registered with bind."

Exactly how do I do that?

Here's what I want to accomplish:

  1. bind a function to a submit event
  2. call that bound function with a trigger
+1  A: 

Check the Events/submit and Events/trigger functions:

$('#formId').submit(function(){
  // form submission logic
});

//...

$('#formId').trigger('submit');
//trigger the submission

You could also bind event handlers using the bind function:

$('#formId').bind("submit", function(){
  // form submission logic
});
CMS