Calling functions - Why doesn't function fire?
<p>I have 2 jquery/javascript scripts containing the same function. 1 fires, 1 doesn't. Unfortunately this is not my bag and can't understand why.</p>

<p>SCRIPT1 - THIS DOES NOT FIRE</p>

<pre><code>function popupTerms() {    
    $(".popup-terms").click(function (e) {    
        pd(e);
        window.open(this.href, this.target, 'menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, width=980, height=640, left=50, top=50');
    });
}
</code></pre>

<p>Script1 is initialised in pageLoad</p>

<pre><code>pageLoad();
</code></pre>

<p>SCRIPT2 - THIS DOES FIRE</p>

<pre><code>jQuery(function ($) {        
    $(".popup-terms").click(function (e) {
        pd(e);
        window.open(this.href, this.target, 'menubar=0, toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, width=980, height=640, left=50, top=50');
    });
});
</code></pre>

<p>Anyone point me in the right direction?</p>

<hr>

<p>UPDATE 11:12</p>

<p>Firstly I can confirm that both functions do fire in $(document).ready.</p>

<p>The reason function 1 is called from ajax pageLoad is because the website is asp.net and makes use of ajax update panels.</p>

<p>After the page is posted back, the function no longer fires when initiated via $(document).ready.</p>

<p>After more testing, I've found the cuprit to be the function pd(e);</p>

<pre><code>function pd(e) {
    if (e.preventDefault)
        e.preventDefault();
    else
        e.returnValue = false;
}
</code></pre>

<p>If I call it from my popupTerms function it doesn't work, however if I copy the code into the popupTerms function it does work.</p>

<p>Any ideas what i'm doing wrong?</p>
