jQuery Input Blur


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $.fn.focus_blur = function() {
  2. $(this).css({color:'#999999'});
  3. return this.focus(function() {
  4. if( this.value == this.defaultValue ) {
  5. this.value = "";
  6. }
  7. $(this).css({color:'#333333'});
  8. }).blur(function() {
  9. if( !this.value.length ) {
  10. this.value = this.defaultValue;
  11. $(this).css({color:'#999999'});
  12. }
  13. });
  14. };
  15. $(".input_textbox").focus_blur();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.