<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 10/27/2011 10:45 AM, Carl Wiedemann wrote:
    <blockquote
cite="mid:CAGqH+MG9wqsJ_DAD-4WmBS1XTd=k=BcHZ7pRwWF43dxoxCi6VQ@mail.gmail.com"
      type="cite">A better method of doing this is to specify JS event
      handlers via a separate file in drupal_add_js() using
      Drupal.behaviors. I don't know of go-to documentation for this off
      of the top of my head, but do some searching and look at examples
      in other core modules.<br>
    </blockquote>
    Perhaps something like:<br>
    <br>
    <pre>// Using the closure to map jQuery to $. </pre>
    <pre>(function ($) {</pre>
    <pre>&nbsp; // Store our function as a property of Drupal.behaviors.</pre>
    <pre>&nbsp; Drupal.behaviors.myModuleSecureLink = {</pre>
    <pre>&nbsp;&nbsp;&nbsp; attach: function (context, settings) {</pre>
    <pre>      $('#formid #input-name').bind('focus', function() {
       &nbsp;alert('User clicked on "foo."');
      });</pre>
    <pre>&nbsp;&nbsp;&nbsp; }</pre>
    <pre>&nbsp; }</pre>
    <pre>}(jQuery));</pre>
    <pre><code></code></pre>
    <code><br>
    </code>
    <pre class="moz-signature" cols="72">-- 
Michael Favia                   <a class="moz-txt-link-abbreviated" href="mailto:michael@favish.com">michael@favish.com</a>
tel. 512.669.5650            <a class="moz-txt-link-freetext" href="http://www.favish.com">http://www.favish.com</a>
</pre>
  </body>
</html>