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

HTML

Auto-hiding placeholder text

I was having a problem auto-hiding placeholder text in Firefox.

Came across this: http://jsfiddle.net/alicetheblue/Yy48L/

So now the text disappears when clicked.

Haven't tested on IE or PC - but that's another can of worms ;)

5 Answers

@Marsha - Browser support is IE10, and recent versions of Firefox, Opera & Safari.

You can get more details on placeholder browser support, over on Can I Use

<input type="text" placeholder="enter your text" onfocus="this.placeholder = ''"     onblur="this.placeholder = 'enter your text'" />

I think placeholders don't go away until the user starts typing are preferable from a UX perspective.

Check out this demo

That's a seriously neat trick, I didn't know that there were event attributes using HTML, it's like a whole new world.

Yeah! I'm fairly certain that it's been possible to add event attributes to tags since HTML 4. It's kind of a nifty work around, don't you think?