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);
             }
        });
  • 相关阅读:
    协程—gevent模块的使用
    协程—概念以及基本使用
    Python—同步和互斥
    Hugo博客搭建
    Linux编辑利器-Vim
    Linux命令与Shell
    python入门基础
    .netcore程序在linux下用supervisor守护
    .netcore中添加Swagger
    winform或wpf中全局异常捕获
  • 原文地址:https://www.cnblogs.com/waitingbar/p/3156746.html
Copyright © 2011-2022 走看看