Skip to content

Instantly share code, notes, and snippets.

@daronspence
Last active August 29, 2015 14:19
Show Gist options
  • Save daronspence/77933dc6d6b90b01de0e to your computer and use it in GitHub Desktop.
Save daronspence/77933dc6d6b90b01de0e to your computer and use it in GitHub Desktop.
WTV Project Category Must Be Assigned
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!');
}
});
@daronspence
Copy link
Author

Categories must be assigned before publishing / updating a project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment