I'm using Mutation Observer with JS to observe the change on a button. When it changes I want to check for a conditional and then decide whether I should disable or enable the same button. When I test this logging either "enabled" or "disabled" on the console, it works, but when I add myButton.setAttribute('disabled', true);
it seems to stop working and doesn't even log the message in the console. So I think maybe that is not the way to disable a button on a Mutation Observer.
I'm using a counter for my code to run only if the counter is under 10 because without it, it loops infinitely. That worked to stop the loop but it still doesn't disable the button.