Skip to content

Instantly share code, notes, and snippets.

@fcmendoza
Last active August 29, 2015 14:12
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 fcmendoza/35ad5dba45b6379a4c92 to your computer and use it in GitHub Desktop.
Save fcmendoza/35ad5dba45b6379a4c92 to your computer and use it in GitHub Desktop.
jQuery samples
// This code gets all textboxes with the 'required' class and
// executes a method for those that don't have a value.
$(":text .required" ).each(function( index, element ) {
var self = this;
var labelText = $('label[for=' + self.id + ']').text();
if (element.val() == "") {
message("Please fill " + labelText, "#" + self.id);
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment