zoukankan      html  css  js  c++  java
  • placeholder兼容ie8

    <script type="text/javascript">  

      if( !('placeholder' in document.createElement('input')) ){  
       
        $('input[placeholder],textarea[placeholder]').each(function(){   
          var that = $(this),   
          text= that.attr('placeholder');   
          if(that.val()===""){   
            that.val(text).addClass('placeholder');   
          }   
          that.focus(function(){   
            if(that.val()===text){   
              that.val("").removeClass('placeholder');   
            }   
          })   
          .blur(function(){   
            if(that.val()===""){   
              that.val(text).addClass('placeholder');   
            }   
          })   
          .closest('form').submit(function(){   
            if(that.val() === text){   
              that.val('');   
            }   
          });   
        });   
      }  
    </script> 
  • 相关阅读:
    blocking to nonblocking of Python
    hug -- Embrace the APIs of the future
    supplychain on blockchain
    xstate -- JavaScript state machines and statecharts
    计算PI -- 采用刘徽的割圆术方法
    Gunicorn
    AIOHTTP
    APScheduler
    prefect
    FastAPI
  • 原文地址:https://www.cnblogs.com/tzz-ing/p/5773841.html
Copyright © 2011-2022 走看看