Welcome to the Treehouse Community
Looking to learn something new?
Hidden input for secure reasons
In the video, we use css to hide the input. Can we use the attribute input type="hidden" with the same effective result?
type="hidden" in the form element will give it away. CSS hides it without any traces whatsoever unless the bot is smart enough to check CSS. But
type="hidden" says it right there in the element, that this element is hidden. It marks the element for something different, and bots might take notice of that. Additionally,
type="hidden" elements pass under the radar of most of your average users, and a bot wants to simulate that, so it probably won't touch those elements.
If you're looking to separate concerns a little more, you could always do
style="display:none;" in that particular element you want to hide. That way, it doesn't occupy any space in your stylesheet. Bots probably won't be smart enough to check inline CSS, but if they are, it's a good shot that they'll be checking all CSS, and so the honeypot is broken in that case anyway.
TL;DR: You can't/shouldn't; use
style="display:none;" in that element instead.
I'm not an expert in this, so if anyone wants to add something, go right ahead.