To disable an element in JavaScript, you can use the disabled
property of the DOM element. Here's an example function that disables an element:
index.tsx141 chars7 lines
The disableElement
function takes an element ID as its parameter and gets a reference to the element using the getElementById
method. If the element exists, it sets the disabled
property to true
.
gistlibby LogSnag