Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Disabling Element through JavaScript

Hi community!

I have a question about disabling an element trough javascirpt. The problem is when I clicked the "Edit" button the disabled attribute won't add to the element unless I clicked it on second time.

Please see here my codes. http://w.trhou.se/1ztht7z57n

Thanks for your help!

1 Answer

You can try setting the disabled attribute to "true" instead, which seems to work. I believe this has to do with the difference between a property and an attribute, but I'm unprepared to explain the difference!