占位符不与Internet Explorer一起使用 [英] Placeholder not working with internet explorer

查看:139
本文介绍了占位符不与Internet Explorer一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在挣扎几个小时,我需要了解为什么我的网站(使用Drupal 7.50)没有在Internet Explorer 11上显示任何占位符?



我已经尝试了很多我见过的东西,就像这些:


  • 本网站(hagenburger)出现此错误


  • $ b


    语法错误,无法识别的表达式:'[placeholder]'






    我也尝试从其他stackoverflow帖子定制Javascript,但这些占位符仍未显示。



    我也试着改变CSS,但没有成功:

     : -  ms-输入占位符{ / * IE10-11 * / 
    颜色:#ccc!important;
    font-weight:400!important;
    }

    :: - ms-input-placeholder {/ * Edge * /
    color:#ccc;
    font-weight:400;
    }

    :: placeholder {/ * CSS工作草案* /
    颜色:#ccc;
    font-weight:400;
    }

    我真的迷失了,一直在挣扎,解决这个问题?




    编辑

    这是一个例子我使用的输入:

     < input required =requiredplaceholder =Votreâge(例如:28) class =form-control form-text requiredid =edit-submitted-agename =submitted [age]value =size =60maxlength =128autocomplete =offtype = 文本 > 






    更新



    我可能找到了一种方法,但我不确定,当我将站点兼容模式从9(默认值)更改为10或11时,我发现它正在工作。因此,如果有方法设置兼容性模式当访问网站,然后解决。

    解决方案

    终于找到了解决这个问题的方法,仿真默认设置为9在调试器的屏幕上,即使Internet Explorer 11正在使用,所以我将它添加到HTML的头标记中。

     < ; meta http-equiv =X-UA-Compatiblecontent =IE = 11> 

    将兼容格式更改为IE11。


    I've been struggling for some hours now and I need to understand, why my website (using Drupal 7.50) isn't showing any placeholder on Internet Explorer 11?

    I've already tried lots of things I've seen, just as these :

    Syntax error, unrecognized expression: '[placeholder]'

    I also tried custom Javascript from other stackoverflow posts but those placeholder are still not shown.

    I also tried to change the CSS just as this but without success :

    :-ms-input-placeholder { /* IE10–11 */
        color: #ccc !important;
        font-weight: 400 !important;
    }
    
    ::-ms-input-placeholder { /* Edge */
        color: #ccc;
        font-weight: 400;
    }
    
    ::placeholder { /* CSS Working Draft */
        color: #ccc;
        font-weight: 400;
    }
    

    I'm really lost and been struggling for a while, any suggestions on how to resolve this issue ?


    EDIT

    Here's an exemple of an input I'm using:

    <input required="required" placeholder="Votre âge (ex:28)" class="form-control form-text required" id="edit-submitted-age" name="submitted[age]" value="" size="60" maxlength="128" autocomplete="off" type="text">
    


    UPDATE

    I might found a way but I'm not sure, I saw that it's working when I change the site compatibility mode from 9 (default) to 10 or 11. So if there is a way to set a compatibility mode when accessing the website then it's resolved.

    解决方案

    Finally found how to resolve this issue, the emulation was set at 9 as default on the debugger's screen even if internet explorer 11 was being used, so I added this on the head tag of the HTML.

    <meta http-equiv="X-UA-Compatible" content="IE=11">
    

    Which changes the compatability format to IE11.

    这篇关于占位符不与Internet Explorer一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆