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 trialKevin Barnes
18,352 Pointsinput.className returns blank
Hey,
Followed along with this video, and it's all good. I'm just curious though, when I used the console to get the class (input.className) it just showed "".
The HTML input element has a class assigned to it, I'm just curious why this wouldn't work? Has something changed since this video was made?
1 Answer
Kevin Barnes
18,352 PointsYou know what... I'm an idiot - just noticed the lack of a '=' when declaring the classes.
Kevin Barnes
18,352 PointsKevin Barnes
18,352 PointsNeedless to say, this is causing issues in later videos where getting inputs by their class name keeps returning null. I would love some help here because it's driving me insane. I've checked the code over so many times and I can't see any issues, just for some reason the browser thinks the inputs don't have a class name.
P.S. This even happens when opening a new workspace on the video, so I'm 99.9% sure it's not a problem with the code.