Pass Jquery alias into javascript function
<p>Im creating a theme for wordpress and I need to use some jQuery. Ive found bits of code online and ive made a few bits myself. However, when using jQuery provided by wordpress it is in noConflict mode and instead of using $ it is set to "jQuery". That is fine but I dont want to have to modify all my code and any code I find online to use "jQuery" instead of $.</p>

<p>So it tells me that by placeing <code>function ($)</code> at the end you are able to use the $ as the jQuery alias, but only in that functions scope. That is fine, but I was hoping that it would work and pass through to the functions I call from inside that scope. That is where my problem is. How can I make the jQuery code that uses $ inside my "resizeandcenter" function work.</p>

<pre><code>jQuery('.artworklist &gt; li &gt; a &gt; img').load(function ($){
   resizeitems('artworklist');
});
</code></pre>

<p>This is my function that I want to be able to use the $ inside as I dont want to have to modify all my code / and any code I find online.</p>

<pre><code>function resizeitems(elementname){
    //Do some jquery stuff using $
}
</code></pre>

<p>Perhaps there is an alternative way to do what I am doing or I am doing it wrong?</p>

<p>EDIT:</p>

<p>My function "resizeitems" is on its own in a js file thats included in my page header.</p>

<p>The other code, the jQuery code in my first code block is at the bottom of the page in a script block.</p>

<p>So im a bit unsure about the answer saying to wrap my function?</p>
