简体   繁体   English

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

[英]why the Placeholderdo not work in IE8?

when i onblur on the input which type is "password",it will hide the placeholder thing and the input. 当我输入哪个类型是“密码”时,它会隐藏占位符和输入。

plugin github link 插件github链接

ok,we take the the jquery.placeholder.js 好的,我们采用jquery.placeholder.js

and we can see the line 57 我们可以看到第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()
            });
        }

add the code "input.show();" 添加代码“input.show();” ,you can make the input not hide in IE8. ,你可以让输入不隐藏在IE8中。

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

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