Placeholder
Although HTML5 has a placeholder attribute, for now it only works in browsers with the webkit engine.
Having looked at some posts on the hub, I saw that some invented a bicycle, and another script, which supposedly makes this attribute cross-browser, displays asterisks in fields like password.
Actually, he wrote a modest jQuery code that supports this whole thing.
- What are you talking about?
You can touch it here . Be sure to click the submit button and look in the address bar after the absence of a placeholder text.
- And how to use?
It's simple: - I see "$". Need jQuery? Yes of course. Preferably the freshest. - Does it work everywhere? I tested in IE7.8; FF3.5; Opera 10.01. Chrome and Safari are not required in this script, as understand the placeholder attribute. (The script provides this) - Well, where to download? Here . UPD: 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 enter the placeholded class description in the CSS table,
while adding the placeholder attribute with the desired text to all the necessary fields. The script for the DOMReady event will bypass all fields with the placeholder attribute and apply measures for non-webkit browsers.
_________________________
The script is not mine. It was posted here at the request of my comrade, who so far is not yet Habrauser. I hope that someone will come in handy.
Having looked at some posts on the hub, I saw that some invented a bicycle, and another script, which supposedly makes this attribute cross-browser, displays asterisks in fields like password.
Actually, he wrote a modest jQuery code that supports this whole thing.
- What are you talking about?
You can touch it here . Be sure to click the submit button and look in the address bar after the absence of a placeholder text.
- And how to use?
It's simple: - I see "$". Need jQuery? Yes of course. Preferably the freshest. - Does it work everywhere? I tested in IE7.8; FF3.5; Opera 10.01. Chrome and Safari are not required in this script, as understand the placeholder attribute. (The script provides this) - Well, where to download? Here . UPD: all options (color, className, handle_send, handle_password) are optional! The example only shows their standard values. UPD2: There is a new version: link
options = {
color: '#ccc', //цвет текста placeholder'а
className: 'placeholded', //класс для работы
handle_send: true, //операции с сабмитом.
handle_password: true //издевательство над password-полем
};
$("#myinput").blurfocus('Тест плейсхолдера', options);
. It differs in that you only need to insert the script
and enter the placeholded class description in the CSS table,
<style type="text/css">.placeholded {color: #цвет;}</style>
while adding the placeholder attribute with the desired text to all the necessary fields. The script for the DOMReady event will bypass all fields with the placeholder attribute and apply measures for non-webkit browsers.
_________________________
The script is not mine. It was posted here at the request of my comrade, who so far is not yet Habrauser. I hope that someone will come in handy.