I’ve been asked to place a form on our website, simple you might think, but this one has some cool little js in place to make the label for the input sit inside it, clever but for some reason not working as intended on my page.
It doesn’t place the label inside the Input field.
It uses the JS to place the label and CSS for the color changes and such.
Thanks anyone for any help 🙂
although you can do it, this is not ideal. there’s a perfectly valid way forward via a HTML5 input improvement known as ‘placeholder’.
a while back I wrote a placeholder=”” class for mootools that is basically, a progressive enhancement for browsers that lack HTML5 placeholder capabilities (at the time of writing, anything that’s not webkit)
http://fragged.org/mooplaceholder-input-placeholder-behaviour-class_1081.html
the fiddle: http://jsfiddle.net/hFtNd/1/
the class itself:
and to style, you can just use the html5 classes (vendor specific atm):
so it does not look like I am pimping my own class, have a look for similar solutions on the mootools forge, i know Oskar and Seanmonstar did one ( http://demo.mootools.net/forge/p/mootools_placeholder – check github for their forks) and Thierry Bela did one ( http://mootools.net/forge/p/placeholder) and there’s the Apple placeholder ( http://demo.mootools.net/forge/p/apple_placeholder)
either way, do it the right way that will be most compatible and with longevity in mind (with feature detection, your javascript does not need to do anything which is ideal)