← All challenges
Challenge
Button Loading State
Easy- javascript
- css
- animation
Build a submit button that reacts to a click. It disables itself, swaps its text for a spinner, and after about two seconds goes back to normal, as if a request had finished.
Notes:
- The starter has one
<button id="btn">Submit</button>. - No real request is made. A timer stands in for the wait.
Check your work against
- Clicking the button disables it and shows a spinner
- The spinner is an actual animated element (a CSS animation), not a static icon
- The button re-enables and restores its original text after the simulated delay
No automatic grading
Check your work against the list above, then compare it with the solution preview.
Tab indents. Press Esc, then Tab to leave the editor.
Live preview
Starter loaded. The preview updates as you type.