title: Changing onclick handler for an element after first click
body: <pre><code>   div.onclick = function(data, dom) {
          return function() {
             if (data.seenAlready == true) { // HACK
                $(this).children().toggle();
                return;
             }
             recursiveSearch(data, dom);
  
            // after this onclick, I want to assign it to a toggle like function. no clue how to do it.
         }
    }(child, mycontainer.appendChild(div));
  </code></pre>
  
  <p>I'm trying to swap the onclick method after first onclick on a dom element. I've just not had any success, it seems to some sort of closure loss, or something. I'm fine using jQuery.</p>