how to turn a function from function(element) syntax to $(element).function() syntax
<p>I have a function that accepts the element it needs to operate on as a parameter <code>element</code></p>

<pre><code>function changeColor(element){
   $(element).find('.middleBox').each(function(){
       $(this).//do some stuff that does not matter now;
   });
}
</code></pre>

<p>and I call it this way </p>

<pre><code>changeColor($(document)); //this applies it to the whole document
changeColor($('#sectionOne')); //this applies it to only part of the document 
</code></pre>

<p>I want to change it from the format where it accepts its object as a param to this format. How do I do it</p>

<pre><code>$('#sectionOne').changeColor();
$(document).changeColor();
</code></pre>
