开发者

Using jQuery Labelify Plugin

This is Labelify: http://www.kryogenix.org/code/browser/labelify/

Basically, it allows me to put a light grey text into my text boxes that disappears when they're selected.

I only have two problems:

  • I am using the jQuery UI Datapicker on a field that has this sort of label, and when I click on the date I want, the field shows the date but still grey (inputted text should appear black).
  • For fields that have a password, is there a way to have the password still look like an input that开发者_StackOverflow is type=password, but to have the light grey label appear as plaintext? When I tried to Labelify the password fields, the label just showed up as the label's length in dots rather than plaintext.

Thank you!


Use the guide provided athttp://www.electrictoolbox.com/jquery-toggle-between-password-text-field/ instead of Labelify. It supports password fields too. Don't know about the datetime field.
UPDATE: take a look at the following links. You have many choices:
http://plugins.jquery.com/project/inlineFieldLabel
Label for password field


I realize this post is old, but I needed Labelify to do password fields as you mentioned so I added this bit of code after the if (!lookupval) { return; } code section, which should be at line 51.

  // Crob -- I added this to add the ability for Labilify to handle password fields.
  // This creates a separate text field that just shows the value of title from the password field
  // When focus is placed on the field it is hidden and the real field is shown.  When focus is lost
  // off the real field the text field is shown if there wasn't anything typed into the real field.
if ($(this).attr("type") === "password")
{
    var newField = $('<input>').attr('type', 'text').attr('value', lookup(this).replace(/\n/g, ''))
        .addClass("ui-input-text ui-body-c")
        .data('passwordField', $(this).attr('id'))
        .attr('id', 'PassHelper-' + $(this).attr('id'))
        .focus(function () { $("#" + $(this).data('passwordField')).show().focus(); $(this).hide(); });
    $(this).blur(function ()
    {
        if ($(this).val() == "")
        { $(this).hide(); $('#PassHelper-' + $(this).attr('id')).show(); }
    });
    $(this).after(newField);
    $(this).hide();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜