How to enable a disabled checkbox dynamically?

Just do With this you are setting the property of the DOM element, while setting attribute presence of attribute disabled will disable the check box, so even if you do x.setAttribute(“disabled”, “false”); it will still be there on the element as attribute. Demo or you would just do: disabled as attribute and disabled as property are different.

Creating Multiple Modals on a Single Page

You assigned the same Id to both modal triggering buttons. Different elements shouldn’t have the same Id. In you JavaScript code, you always pick a single element (a single close button, a single open button, etc). It’s a HTML/JS beginner’s mistake I would say. This would work:

Show or hide element in React

React circa 2020 In the onClick callback, call the state hook’s setter function to update the state and re-render:  Run code snippetExpand snippet JSFiddle React circa 2014 The key is to update the state of the component in the click handler using setState. When the state changes get applied, the render method gets called again with the new state: