ie的兼容性总结

2017-03-23  本文已影响0人  后知不觉1
这是自己在工作中遇到的兼容性调整的笔记,不定时更新

1.兼容ie9以下的<input>标签的placeholder属性问题

        <!--[if lt IE 10]>
              <script>
            //这段代码是兼容ie8以下的input标签的placehodler属性可以复用
        
                //页面加载填充value
                placeholderExchange();
            
                function placeholderExchange(){
                    var tempInput = $("input")
                    for(var i=0;i<tempInput.length;i++){
                        $(tempInput[i]).val($(tempInput[i]).attr("placeholder"))
                    }
                }

                $("input").focus(function(){
                    $(this).val('')
                })
                $("input").blur(function(){
                    var tempPlaceholder = $(this).attr("placeholder")
                    if($(this).val()==''){
                        $(this).val(tempPlaceholder)
                    }else{

                    }
                })    
               </script>
          <![endif]-->
上一篇 下一篇

猜你喜欢

热点阅读