JSFiddle - React, Tailwind, and code Playground
by Comandeer
HTML
<input disabled>
<button>Włącz/wyłącz pole</button>
JavaScript
const input = document.querySelector( 'input' );
const observer = new MutationObserver( function( mutations ) {
mutations.forEach( ( mutation ) => {
console.log( mutation );
} );
} );
observer.observe( input, {
attributes: true
} );
document.querySelector( 'button' ).addEventListener( 'click', () => {
input.disabled = !input.disabled;
} );