title: passing javascript object to function in a jquery way?
body: <p>Yeah so I've been messing around with javascript a while but only recently got into stuff like object orientation, prototyping and using objects for all functions and vars.</p>
  
  <p>But, many frameworks like jQuery or extJS have something I have yet to grasp, you can define an object by using a built in function for searching the dom, example:</p>
  
  <pre><code>var a = $('#mydiv');
  </code></pre>
  
  <p>and then you can do a.click(function);</p>
  
  <p>So my question is, how can I create a "framework" of sorts where I can write code in that style, like example:</p>
  
  <pre><code>var mydiv = document.querySelector('mydiv');
  mydiv.neph(args,args);
  </code></pre>
  
  <p>So I have my object defined, in this case it's a dom element or whatever, now I pass it to my function "neph" with arguments, I want to create code that allows me to do this. But since mydiv does not have any function, it only has in this case the dom element right so mydiv.neph does not exist, but in jquery you can define whatever var and .click or .mouseover or whatever does exists within the object as functions? Confusion ensues! :D</p>
  
  <p>Ok sorry if this is a retarded question btw =P</p>