JSFiddle - React, Tailwind, and code Playground
by zzzzBov
HTML
<input type="text" id="foo" />
<button id="bar">Disable</button>
JavaScript
$.fn.toggleProp = function (p) {
this.prop(p, function (_, val) {
return !val;
});
return this;
};
$('#bar').on('click', function () {
$('#foo').toggleProp('disabled');
});