Skip to content

Instantly share code, notes, and snippets.

@vsync
Created May 16, 2013 00:16
Show Gist options
  • Save vsync/5588487 to your computer and use it in GitHub Desktop.
Save vsync/5588487 to your computer and use it in GitHub Desktop.
$('.submit').click(function(){
var empty = 0;
$(':input.required').each(function() {
if($(this).val().length == 0) {
var field = $(this);
field.addClass('mustfill');
$('div#inputwarning').fadeIn(300);
empty = 1;
}
else {
if(field.hasClass('mustfill')) {
field.removeClass('mustfill');
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment