zoukankan      html  css  js  c++  java
  • 实现表单的输入框当光标为当前时,去掉默认值

    作用:实现表单的输入框当光标为当前时,去掉默认值,当光标离开原默认值没有发生改变时,再次显示默认值,按钮除外;

    实现代码如下(jquery版):

    $(":input").not(":input[type=submit],:input[type=button]").focus(function(){
              if($(this).val() ==this.defaultValue){  
                  $(this).val("");           
              } 
        }).blur(function(){
             if ($(this).val() == '') {
                $(this).val(this.defaultValue);
             }
        });
  • 相关阅读:
    robotframework-ride1.7.3.1更新安装
    批量删除新浪微博
    Redis
    GET和POST两种基本请求方法的区别
    selenium2自动化测试实战--基于Python语言
    同步/异步/阻塞/非阻塞/BIO/NIO/AIO
    HTTP抓包实战
    LCT模板(BZOJ2631)
    树链剖分模板(BZOJ3083)
    凸包(BZOJ1069)
  • 原文地址:https://www.cnblogs.com/waitingbar/p/3156746.html
Copyright © 2011-2022 走看看