JSFiddle - React, Tailwind, and code Playground

by ifaour

HTML

<input type="text" value="testttt" />
<input type="button" value="Toggle Disabled" />

JavaScript

(function($) {
    $.fn.toggleDisabled = function() {
        return this.each(function() {
            var $this = $(this);
            if ($this.attr('disabled')) $this.removeAttr('disabled');
            else $this.attr('disabled', 'disabled');
        });
    };
})(jQuery);

$(function() {
    $('input:button').click(function() {
        $('input:text').toggleDisabled();
    });
});