Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
( function ( $ ) {
$( document ).ready( function () {
//Require post title when adding/editing Project Summaries
$( 'body' ).on( 'submit.edit-post', '#post', function () {
// If the title isn't set
if ( $( "#title" ).val().replace( / /g, '' ).length === 0 ) {
// Show the alert
window.alert( 'A title is required.' );
// Hide the spinner
$( '#major-publishing-actions .spinner' ).hide();
// The buttons get "disabled" added to them on submit. Remove that class.
$( '#major-publishing-actions' ).find( ':button, :submit, a.submitdelete, #post-preview' ).removeClass( 'disabled' );
// Focus on the title field.
$( "#title" ).focus();
return false;
}
});
});
}( jQuery ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment