Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This script is an update of http://www.perfectline.co/2009/10/change-input-field-placeholder-with-jquery/
- // If you need input[type=password] support use http://pastebin.com/xX5U1vpK
- $(document).ready( function() {
- $(".placeholder").each( function( ) {
- var elem = $(this);
- var text = elem.attr('rel');
- if ( elem.val() === '' )
- elem.val( text );
- elem.focus( function() {
- if ( elem.val() === text )
- elem.val('');
- });
- elem.blur( function() {
- if ( elem.val() === '' )
- elem.val( text );
- });
- var form = elem.parents('form:first');
- form.submit( function() {
- if (elem.val() === text)
- elem.val("");
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement