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 trialZoe Xiao
7,195 Pointswhy use different methods to set an input field or submit button disabled?
$("#search").prop("disabled",true); and $("#submit").attr("disabled",true);
why not use .prop() on the submit button?
3 Answers
Dave McFarland
Treehouse TeacherHI Zoe Xiao
You are correct. They should both use jQuery's prop()
method. The attr()
method still works, but should be used to set HTML attributes like href
and src
not properties like disabled
or checked
.
chanlennon
3,468 PointsThanks for asking and answering the same question pops in my head to both of you. Treehouse is really cool place.
Daniel Smolentsev
6,377 Pointshttp://stackoverflow.com/questions/6003819/properties-and-attributes-in-html Some more explanation between the differences of Properties and Attributes. Great question Zoe.
Zoe Xiao
7,195 PointsZoe Xiao
7,195 PointsThanks Dave. I am clear now.