JavaScript, JQuery Problem: Function triggered automatically when page load!
<p>I'm a newbie in jQuery, so excuse me for asking such a simple question. I want to use <a href="http://plugins.jquery.com/project/spin-button" rel="nofollow">jQuery Spin</a> library and get notified when the value is changing. Here is my code:</p>

<pre><code>&lt;script&gt;
$(document).ready(function(){
    $.spin.imageBasePath = './theme/css/images/spin1/';
    $('#spin1').spin({
        min: 1,
        max: 99,
        lock: true,
        beforeChange: calculate_price()
    });
});

function calculate_price() {
    $('#lblTotalPrice')[0].innerHTML = $('#spin1')[0].value;
}
&lt;/script&gt;
</code></pre>

<p>It's very simple. But the problem is "calculate_price" function is triggered everytime page loaded and it did not trigger when user change the value of Spin Edit.</p>

<p>Does somebody have an idea why this is happening?</p>
