title: Managing multiple event handlers in jQuery
body: <p>I have a form that I'm working on that needs to have multiple events fired when an input loses  focus, i.e. the blur event gets fired.I am having trouble managing what order the various event handlers that need to respond to this are called.</p>
  
  <p>Each form input tag needs various things to happen to it on blur.</p>
  
  <ol>
  <li>Various auto formatters such as making sure the names start with a capital letter or showing areas of the form according to checkboxes. </li>
  <li>jQuery Validation. </li>
  <li>Post validation functions such as an ajax call</li>
  </ol>
  
  <p>So far the best method I have come up with is to rely on the event bubbling system. Therefore, making sure that all the events from point 1 are attached using jQuery.on() to an element that is deeper into the DOM than the validation rules. Jquery validation attaches event listeners to the form element. </p>
  
  <p>Whist this works it has a couple of problems. It works for the 3 classes of events I have it could well become a problem when I have more.</p>
  
  <p>Is there a publisher/subscriber sort of system that people use with jQuery to make this sort of this easier?</p>