Skip to content

Instantly share code, notes, and snippets.

@nicinabox
Created January 21, 2011 20:02
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 nicinabox/790299 to your computer and use it in GitHub Desktop.
Save nicinabox/790299 to your computer and use it in GitHub Desktop.
$('form').submit(function() {
// get all the inputs into an array.
var $inputs = $('#form :input');
// get an associative array of just the values.
var values = {};
$inputs.each(function() {
values[this.name] = $(this).val();
if ($(this).val() == "") {
alert("You haven't filled out all the fields");
return false;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment