Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • This will not disable the button; the button will simply not submit the form when clicked. There is a difference. The most obvious being that the CSS :disabled selector won't work on the button. You could use form:invalid button or similar to work around it, but you'd have to do a lot to counter-act the default styles employed when clicking. Commented Aug 15, 2024 at 20:07
  • I used quotation marks around "disable" advisedly; this achieves the thing that many people actually want to accomplish when they google "disable a button". There are 500 upvotes here already for disabled proper, but I thought the approach that doesn't also disable hover text and confuse the user should be listed since it is in many ways a better practice. Commented Aug 16, 2024 at 2:32