How to do the same?

In General, I don't even know how to explain but I'll try.

I have a function to disable the button:
function buttonDisabled(element, type, callback)
{
 if(!type) element.addClass('disabled').attr('disabled', 'disabled');
 else element.removeClass('disabled').removeAttr('disabled');
 if(typeof callback != 'undefined') callback();
}

I call it thus:

buttonDisabled($(this), false, function() {});


But how to do this? To be able to call through the point
$(this).buttonDisabled(false, function(){});
March 19th 20 at 09:24
1 answer
March 19th 20 at 09:26
Solution
jQuery.fn.buttonDisabled = function(type, callback) {
...
}

then instead of the element use this

Find more questions by tags jQueryJavaScript