Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:danielstocks/jQuery-Placeholder

  • Loading branch information...
commit 563c543aed258eaa6967cdc936773f96cd58f011 2 parents 9073ad4 + a425012
Daniel Stocks danielstocks authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 jquery.placeholder.js
10 jquery.placeholder.js
View
@@ -1,4 +1,4 @@
-/*
+/*
* Placeholder plugin for jQuery
* ---
* Copyright 2010, Daniel Stocks (http://webcloud.se)
@@ -12,7 +12,7 @@
}
// Prevent placeholder values from submitting
$(input[0].form).submit(function() {
- if (input.hasClass('placeholder')) {
+ if (input.hasClass('placeholder') && input[0].value == input.attr('placeholder')) {
input[0].value = '';
}
});
@@ -66,8 +66,8 @@
};
var supported = !!("placeholder" in document.createElement( "input" ));
$.fn.placeholder = function() {
- return supported ? this : this.each(function() {
- var input = $(this);
+ return supported ? this : this.each(function() {
+ var input = $(this);
var placeholder = new Placeholder(input);
placeholder.show(true);
input.focus(function() {
@@ -98,4 +98,4 @@
}
});
}
-})(jQuery);
+})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.