Placeholder not working in IE10

后端 未结 3 1307
粉色の甜心
粉色の甜心 2021-01-16 13:25

html:

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-16 14:02

    i am not sure about placeHolder attribute for input support in ie10,but if u want a placeholder in ie u can do this throug jquery like this below..

    if(navigator.appVersion.match(/MSIE [\d.]+/)){
        var placeholderText = 'Some Placeholder Text';
        $('#loginname').val(placeholderText);
        $('#loginname').blur(function(){
            $(this).val() == '' ? $(this).val(placeholderText) : false;
        });
        $('#loginname').focus(function(){
            $(this).val() == placeholderText ? $(this).val('') : false;
        });
    }
    

    u can do same for password too..

    Have U tried somewhat like this using code...i believe should work...

    $('#loginname').attr('placeholder', 'username');
    $('#password').attr('placeholder', 'password');
    

提交回复
热议问题