Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 16 to 17 of 17
03-09-2013, 07:37 PM #16
- Join Date
- Jun 2007
- Thanked 608 Times in 588 Posts
unlike label, placeholder typically gives an example instead of direction, which a lot of folks find more instructive.
for example, (Zip: [ ]) versus ([ 90210 ]). I can tell at a glance of the placeholder that i don't need my 9 digit zip answering a question before moving the mouse.
one last advantage of placeholder: when combined with the list attrib, you have an indeterminate combo box instead of one with a default value.
the little scripts that try to replicate placeholder end up being quite long, and usually don't mimic the same behavior exactly. Because it's such a nice design pattern, and because the scripting to replicate it is tedious and fragile, they added it to HTML5.
you don't have to use HTML5, i'm sure HTML3 still shows up. It's just that they've added such features after listening to the demands of programmers. It's not all about new capabilities, a lot of it is simply removing all the time-consuming tedium and debugging to do simple things like providing an example value on a form input.
If you like hand-coding because it's fun go ahead, it will work forever. Or, maybe you want the deck chairs of a titanic like IE8 to be comfortable for the next several months while the ship sinks... more power to you.
03-09-2013, 08:12 PM #17
- Join Date
- Jun 2002
- London, England
- Thanked 2,579 Times in 2,557 Posts
rnd me - I am prepared to accept that HTML5 has clear advantages on mobile browsers.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.