0

I am calling a function on a click event. The return is getting multiplied each time.

btn.on('click', function(){
    $.when(foo()).then(funtion(value){
        console.log(value);
    });

});

function foo(){
    //some process
    return value;
}

When I click the first time I get one value printed. Second time I get two values and it keeps on increasing.

How to make it return only one value?

Abel D
  • 1,040
  • 1
  • 18
  • 30
  • 2
    possible duplicate of [jQuery click events firing multiple times](http://stackoverflow.com/questions/14969960/jquery-click-events-firing-multiple-times) – Paul Aug 11 '15 at 07:22
  • Need to see your surrounding code. You might be binding your click handler inside a block of code that is executed more than once – DGS Aug 11 '15 at 07:26
  • Yes using .unbind on click solved the issue. – Abel D Aug 11 '15 at 07:26

0 Answers0