Skip to content

Commit

Permalink
Apply the click handler on the submit button instead of the entire form
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Feb 4, 2010
1 parent 1ee4b18 commit 96a91c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions jquery.placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
};
};
// Submit handler on all forms containing input[placeholder]
$('form:has([placeholder])').click(function() {
// Needs to be via .click()
$('form:has([placeholder]) input[type=submit]').click(function() {
// if ($(this).has('.placeholder') never returns false here — WTF?
if ($(this).find('.placeholder').length) {
$(this).find('.placeholder:first').val('').focus().removeClass('placeholder');
if ($(this.form).find('.placeholder').length) {
$(this.form).find('.placeholder:first').val('').focus().removeClass('placeholder');
return false;
};
});
Expand Down
2 changes: 1 addition & 1 deletion 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 96a91c4

Please sign in to comment.