Created
May 31, 2013 00:07
-
-
Save vsync/5682204 to your computer and use it in GitHub Desktop.
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
var empty = 0; // Apumuuttuja | |
$(':input.required').each(function(){ | |
var field = $(this); | |
if($(this).val().length == 0) { // Jos vaadittu kenttä on tyhjä, asetetaan sille lisäluokka ja näytetään virheilmoitus | |
field.addClass('mustfill') | |
$('div#inputwarning').fadeIn(300); | |
empty = 1; | |
} | |
else field.removeClass('mustfill'); // Jos vaadittu kenttä ei ole tyhjä, poistetaan siltä (mahdollinen) lisäluokka | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment