This file contains 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
( 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