Helptext.js (luckydev.github.com) 6 points by luckydev 14y ago ↗ HN jQuery plugin to have help text in the form elements
[–] koblas 14y ago ↗ Not sure why... in-field labels are a better approach. http://bit.ly/r4vVAa Plus the placeholder attribute is the long term.
[–] Vekz 14y ago ↗ What if I want my password field to say 'password', and on focus to be obscured with dots?
[–] richbradshaw 14y ago ↗ 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. [–] timmyd 14y ago ↗ Was 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... [–] luckydev 14y ago ↗ 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.
[–] timmyd 14y ago ↗ Was 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...
[–] luckydev 14y ago ↗ 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.
6 comments
[ 2.9 ms ] story [ 22.4 ms ] threadfunction hasPlaceholder() { var input = document.createElement('input'); return ('placeholder' in input); }
should do the job to detect support.
http://dev.w3.org/html5/spec/Overview.html#the-placeholder-a...
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.