🔘 Button getAttribute & setAttribute Demo

✅ Target button is currently ENABLED. Click it to see the counter increase!

Target Button

Button clicked 0 times!

Control Buttons

Current Attributes

Loading status...

How It Works:

  • Enable: Uses setAttribute('disabled', '') to remove the disabled attribute
  • Disable: Uses setAttribute('disabled', 'true') to add the disabled attribute
  • Toggle: Uses getAttribute('disabled') to check current state, then toggles it
  • Status: Uses getAttribute() to read multiple attributes and displays them
  • Bonus: Also demonstrates setting custom data attributes and style changes