繁体   English   中英

为什么Placeholderdo不能在IE8中工作?

[英]why the Placeholderdo not work in IE8?

当我输入哪个类型是“密码”时,它会隐藏占位符和输入。

插件github链接

好的,我们采用jquery.placeholder.js

我们可以看到第57行

        // IE < 9 doesn't allow changing the type of password inputs
        if ($.browser.msie && input[0].outerHTML) {
            var fakeHTML = $(input[0].outerHTML.replace(/type=(['"])?password\1/gi, 'type=$1text$1'));
            this.fakePassword = fakeHTML.val(input.attr('placeholder')).addClass('placeholder').focus(function() {
                input.trigger('focus');
                $(this).hide();
                input.show();    //add this code
            });
            $(input[0].form).submit(function() {
                fakeHTML.remove();
                input.show()
            });
        }

添加代码“input.show();” ,你可以让输入不隐藏在IE8中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM