Comment on Helptext.jsComments−richbradshaw14yWhy wouldn't you use the placeholder, attribute, then detect support, then use a fallback if needed... Something like:function hasPlaceholder() { var input = document.createElement('input'); return ('placeholder' in input); }should do the job to detect support.−timmyd14yWas thinking the exact same thing - placeHolder support is native with HTML5 spec - so better to utilize the 'future' and rollback for IE<9http://dev.w3.org/html5/spec/Overview.html#the-placeholder-a...−luckydevOP14ythanks for the info. I created this for my project. It worked, so I open sourced this small chunk of code.In HTML5 way, I need to do it first and then have to write a fallback mechanism. Kinda too long for me :) Instead, I chose what works perfectly now.
Comments
Why wouldn't you use the placeholder, attribute, then detect support, then use a fallback if needed... Something like:
function hasPlaceholder() { var input = document.createElement('input'); return ('placeholder' in input); }
should do the job to detect support.
Was thinking the exact same thing - placeHolder support is native with HTML5 spec - so better to utilize the 'future' and rollback for IE<9
http://dev.w3.org/html5/spec/Overview.html#the-placeholder-a...
thanks for the info. I created this for my project. It worked, so I open sourced this small chunk of code.
In HTML5 way, I need to do it first and then have to write a fallback mechanism. Kinda too long for me :) Instead, I chose what works perfectly now.