I'm a newbie in jQuery, so excuse me for asking such a simple question. I want to use jQuery Spin library and get notified when the value is changing. Here is my code:
<script>
$(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;
}
</script>
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.
Does somebody have an idea why this is happening?