Created
December 29, 2015 19:23
-
-
Save maxkostinevich/961e148527e20a784c89 to your computer and use it in GitHub Desktop.
Submit empty checkbox
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
/* Add before submit action to fix checkbox issue | |
Change value to "off" for not-checked checkboxes and check them. | |
In this case value "off" (instead of original value) will be stored. | |
*/ | |
$('form#post').submit(function(e) { | |
$('#some-wrapper input[type=checkbox]:not(:checked)').each(function(){ | |
var curItem=$(this); | |
curItem.val('off'); | |
curItem.prop('checked', true); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment