给Input标签添加监听事件 值被改变即触发指定任务

//id=customeridcard 标签添加监听改变事件
    (function ($) {
        const o = $.fn.val;
        $.fn.val = function () {
            const r = o.apply(this, arguments);
            if (this.is("#customeridcard") && arguments.length > 0) {
                this.trigger("change");
            }
            return r;
        }
    })(jQuery);

  

 $("#customeridcard").change(function () {
            Method();  //执行方法
        })

  

原文地址:https://www.cnblogs.com/jfeng/p/12911173.html