Skip to content

Commit

Permalink
Return early if the element doesn’t have a placeholder attribute spec…
Browse files Browse the repository at this point in the history
…ified. Thanks for the tip, @gpupo!
  • Loading branch information
mathiasbynens committed Sep 27, 2010
1 parent add0684 commit 73c318c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions jquery.placeholder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* HTML5 Placeholder jQuery Plugin v1.3
* HTML5 Placeholder jQuery Plugin v1.4
* @link http://github.com/mathiasbynens/Placeholder-jQuery-Plugin
* @author Mathias Bynens <http://mathiasbynens.be/>
*/
Expand Down Expand Up @@ -65,8 +65,8 @@
// Yes, .each() — in case .placeholder() is called on several elements, which is very likely, e.g. $('input').placeholder();
return this.each(function() {
var $input = $(this);
// Quit if the current element is not an input/textarea at all
if (!$input.is(':input')) {
// Quit if the current element doesn’t have a placeholder attribute, or is not an input/textarea at all
if (!$input.attr('placeholder') || !$input.is(':input')) {
return;
}
setPlaceholder($input);
Expand Down
4 changes: 2 additions & 2 deletions jquery.placeholder.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 73c318c

Please sign in to comment.