zoukankan      html  css  js  c++  java
  • jquery clear input default value

    jquery 点击清除输入框的value值

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>jquery clear input default value</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script> </head> <body> <form id="form" action="" method="get"> <input type="text" name="First name" value="First name"/> <input type="text" name="Family name" value="Family name"/> <input type="text" name="Email" value="Email..."/> <input type="text" name="password" value="password..."/> <input type="text" name="location" value="City where you live"/> <input type="submit" name="sign up" value="Sign Up"/> </form> <script> $('#form').children(':text').focus(function(){ if(!this.initValue){ this.initValue = this.value; } if(this.value === this.initValue){ this.value = ''; } }).blur(function(){ if(this.value === '' || this.value === null){ this.value = this.initValue; } }); </script> </body> </html>
  • 相关阅读:
    poj2739
    poj1469
    poj2010
    poj1179
    poj1778
    使用数组实现ArrayList的效果
    zgb老师关于java集合的总结
    jah老师中关于集合的总结
    继承一个类或者是实现一个接口注意点
    5、Iterator迭代器的使用
  • 原文地址:https://www.cnblogs.com/cbhello/p/3513419.html
Copyright © 2011-2022 走看看