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
Hannah Novotny
Courses Plus Student 9,275 PointsI keep getting undefined when I file out the form
I cannot figure out why when I fill out the form about posting a pet the name, species and notes say that they are undefined. I have put information in it but I dont know where I went wrong. Here is a snapshot of the code https://w.trhou.se/650pg1ifv1.
1 Answer
Steven Parker
243,318 PointsThe form elements are identified by their "id' properties, but the names in the jQuery selectors are not prefixed by a "#" symbol. Without that symbol, the selector is expected to be a tag name.
Example:
var $name = $('#pet-name'); // note: "#" added