Categorized | Web 2.0

Automating JS Behavior Registration

Gabriel Handford has created a behavior.js script that allows you to unobtrusively automate Event.observe'tion.

Magic is in naming conventions, so that:

HTML:
  1.  
  2. <a class="bvr-observe-click-xhrTheFunction" href="/the/href">The link</a>
  3.  

takes care of:

JAVASCRIPT:
  1.  
  2. Event.observe(theLinkElement, "click", function(event) { xhrTheFunction(event) });
  3.  

Leave a reply

  1. You will post the following soon.
    Go ahead and start typing.