Skip to content

Instantly share code, notes, and snippets.

@zgordon
Created March 26, 2011 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zgordon/888353 to your computer and use it in GitHub Desktop.
Save zgordon/888353 to your computer and use it in GitHub Desktop.
How to attach a single event to an object behavior
var form = $("form");
function validate() {
$("forms input, forms textarea").each(function () {
if($(this).empty alert("failWhale");
})
}
form.onsubmit = validate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment