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.