Mix JavaScript debounce (not plugin) with jQuery event handler?

I asked this on StackOverflow and was directed here…

Instead of including a debounce plugin library for a very small form section of my site, I’ve implemented some of David Walsh’s JavaScript Debounce Function in my code to allow a small wait for slower user input, however I am binding it to the input field using jQuery instead of regular DOM event listener. The code works fine but my main question here is some peer input on if this is ok to do (will it cause unforeseen issues? is there a better method?) I couldn’t find another example on this scenario on stack overflow but if it has been already asked, please do point me in the right direction.

$(function() {

    // debounce function by David Walsh
    function debounce(func, wait, immediate) {
        var timeout;
        return function() {
            var context = this, args = arguments;
            var later = function() {
                timeout = null;
                if (!immediate) func.apply(context, args);
            };
            var callNow = immediate && !timeout;
            clearTimeout(timeout);
            timeout = setTimeout(later, wait);
            if (callNow) func.apply(context, args);
        };
    };

    // allow .5s for slower user input before processing
    var debounceCustomInput = debounce(function() {
        // if both inputs valid
        if ($("#left").val().length > 0 && $("#right").val().length > 0) {
            // process form
            myAjaxFunction();
        }
    }, 500);

    // event binding
    $(document).on("input", "#left,#right", function() {
        // debounce input
        debounceCustomInput();
    });
    
});