Created
July 21, 2017 19:04
-
-
Save pixelcoder/2f5d76262a6f154895dafc75be8eaf41 to your computer and use it in GitHub Desktop.
Tidy up GET requests with jQuery
This file contains hidden or 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
$('form').on('submit', function(e) { | |
$.each($('select'), function(i, v) { | |
$.each($('select option:selected'), function(i, v) { | |
if($(this).val() === ''){ | |
$(this).parent('select').prop('disabled', true); | |
} | |
}); | |
}); | |
$.each($('input'), function(i, v) { | |
if($(this).val() === ''){ | |
$(this).prop('disabled', true); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment