DEV Community

Jordan Kicklighter
Jordan Kicklighter

Posted on

Quick Tip: Disable Button On Click

In a world full of JS frameworks and templating languages, there's still occasionally a need to write very simple pages. With a habit of leaning into Vue, React, etc. it can be easy to forget the basics when we don't need anything flashy.

Here's a tiny snippet to disable a button when it's clicked without the need for any extra JS scripts. It only takes a few words in an onclick attribute. Could be useful if you have some basic HTML form that submits on a button press.

Top comments (0)