Although in HTML5 there is the placeholder attribute, but for now it only works in browsers with the webkit engine.
Having looked at some posts on Habré, I saw that someone was inventing a bicycle, and another script, which supposedly makes this attribute cross-browser, shows asterisks in the fields like password.
Actually, I wrote modest code on jQuery, which supports this whole thing.
- What are you talking about?"Touch" can be
here . Be sure to press the submit button and look in the address bar after the absence of a placeholder text.
')
- How to use?It's simple:
options = {
color: '#ccc', // placeholder'
className: 'placeholded', //
handle_send: true, // .
handle_password: true // password-
};
$("#myinput").blurfocus(' ', options);
- I see "$". Need jQuery?Yes of course. Desirable the freshest.
- Does it work everywhere?I checked in IE7.8; FF3.5; Opera 10.01. Chrome and Safari are not required in this script, because understand the placeholder attribute. (The script provides for this)
- Well, where to download?HereUPD: all options (color, className, handle_send, handle_password) are optional! The example only shows their standard values.
UPD2: There is a new version:
link . It differs in that you only need to insert the script
and place a description of the placeholded class in the CSS table
<style type="text/css">.placeholded {color: #;}</style>
at the same time adding all the required fields to the placeholder attribute with the desired text. The script for the DOMReady event will bypass all the fields with the placeholder attribute and apply measures for non-webkit browsers.
_________________________
The script is not mine. He posted here at the request of my friend, who so far is not yet a Habrayuzer. I hope that someone will find it useful.