首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用jQuery标签化插件

使用jQuery标签化插件
EN

Stack Overflow用户
提问于 2011-03-12 06:54:28
回答 2查看 1.9K关注 0票数 0

这是Labelify:http://www.kryogenix.org/code/browser/labelify/

基本上,它允许我将一个浅灰文本放入我的文本框中,当它们被选中时就消失了。

我只有两个问题:

  • --我正在使用具有这种标签的字段上的jQuery UI数据报头,当我单击所需日期时,该字段显示日期但仍然是灰色的(输入的文本应显示为黑色)。对于有密码的字段,是否有一种方法可以让密码看起来仍然像输入的type=password,但将浅灰标签显示为明文?当我试图标记密码字段时,标签只是以点而不是明文的形式显示为标签的长度。

谢谢!

EN

回答 2

Stack Overflow用户

发布于 2011-03-12 07:03:22

使用http://www.electrictoolbox.com/jquery-toggle-between-password-text-field/提供的指南,而不是Labelify。它也支持密码字段。不知道日期时间字段。

更新:看看下面的链接。你有很多选择:

http://plugins.jquery.com/project/inlineFieldLabel

Label for password field

票数 0
EN

Stack Overflow用户

发布于 2013-03-13 17:02:33

我意识到这个帖子是旧的,但是我需要Labelify做密码字段,就像您提到的那样,所以我在if (!lookupval) { return; }代码部分之后添加了这段代码,应该在第51行。

代码语言:javascript
复制
  // 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
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5281108

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档