Last active
August 29, 2015 14:19
-
-
Save daronspence/77933dc6d6b90b01de0e to your computer and use it in GitHub Desktop.
WTV Project Category Must Be Assigned
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
jQuery('#publish').on('click', function(e){ | |
var $checkboxes = jQuery('#project_categorieschecklist input[name*="project_categories"][type="checkbox"]'); | |
var checked = false; | |
var loop = jQuery.each( $checkboxes, function( i, el ){ | |
if ( true == jQuery( el ).prop('checked') ){ | |
checked = true; | |
return false; // bail early | |
} | |
}); | |
if ( false === checked ){ | |
e.preventDefault(); | |
alert('You must assign a category for this project!'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Categories must be assigned before publishing / updating a project.