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 AJAX Basics (retiring) AJAX and APIs Stage 4 Challenge Answer

Zoe Xiao
Zoe Xiao
7,195 Points

why 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
STAFF
Dave McFarland
Treehouse Teacher

HI 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.

Zoe Xiao
Zoe Xiao
7,195 Points

Thanks Dave. I am clear now.

Thanks for asking and answering the same question pops in my head to both of you. Treehouse is really cool place.

http://stackoverflow.com/questions/6003819/properties-and-attributes-in-html Some more explanation between the differences of Properties and Attributes. Great question Zoe.