Last active
August 29, 2015 14:12
-
-
Save fcmendoza/35ad5dba45b6379a4c92 to your computer and use it in GitHub Desktop.
jQuery samples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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