skip to Main Content

How would one apply debouncer on this jQuery function. So far it makes no call.

 $('.make-ajax-call-js').on($.debounce('change', function (e) {
//whatever ajax call
}));

I have debouncer script included in my js files.

2

Answers


  1. Try like this:

    $('.make-ajax-call-js').change($.debounce(1000, function(e) {
        console.log("It works!");
    }));
    
    Login or Signup to reply.
  2. To fix this, you will have to pass in the debouncing function as a parameter to the jquery click event along with the debounce time

    $('.make-ajax-call-js').click($.debounce(250, function(e) {
        //whatever ajax call
    }));
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search