Passing 'this' as parameter in JavaScript
<p>I have the following code:</p>

<p><strong>HTML:</strong></p>

<pre><code>&lt;label id="copyAddress" class="copyAddress" onclick="CopyAddress(this);"&gt;
    Copy Address
&lt;/label&gt;
</code></pre>

<p><strong>JS:</strong></p>

<pre><code>function CopyAddress(copyAddressLink) {    
  PopulateTarget(copyAddressLink);   
}

function PopulateTarget(link) {
  var targetGroup = $(link).closest('someClass');    
}
</code></pre>

<p>In PopulateTarget function 'link' variable is undefined, while in CopyAddress it has values as is should. </p>

<p>What can cause this problem? Is there some restriction for passing parameters in Java Script? How this should behave? If you need more code to post please tell me.</p>
