This question arose when I was working on answering another question about best practices for placeholder
text in inputs
and textareas
.
Using the HTML5 placeholder
is surely optimal, but at this point in time it still seems necessary to add a degraded solution for older browsers (using javascript).
JsFiddle here : http://jsfiddle.net/leifparker/DvqYU/16/
The question is : Since they both accomplish nearly precisely the same thing, why bother to include both? Why not just utilize the javascript-only solution, and forego the HTML5 implementation until it is (near) universally accepted?
Granted, with this specific example, adding the HTML5 placeholder
attribute and the hasPlaceholderSupport()
function is a fairly minimal addition of lines (4), but since the degraded support is desired, is there any reason to bother with the progressive redundancy?
I'm sure there is rationale on both sides, and I'm curious to hear it.
Thanks in advance!