Home › Forums › Backend Issues (wp-admin) › Using Tab to go from Title to High (after title) › Reply To: Using Tab to go from Title to High (after title)
Hi folks – I know it’s 7 years after this thread started, but I made a solution that does not depend on knowing what the first field is in the after_title field group.
https://gist.github.com/petertwise/8ebb6a76f018494fcc62171d622cc85f
// Admin Functions
( function( $ ) {
// better accessiblity and data entry for ACF
$(document).ready( function() {
// if there is a an "after_title" field group
if ( $( '#acf_after_title-sortables' ).length ) {
// listen for keydown inside the main title field for any add/edit screen
$('body.post-new-php, body.post-php').on( 'keydown', '#title', function( e ) {
var keyCode = event.keyCode || event.which;
// if the key is tab
if ( 9 == keyCode ) {
// don't do the normal core WP behavior
e.preventDefault();
// find the first field in the after_title area
$( '#acf_after_title-sortables .inside > div:first-child' )
.find( ':input:not([type=hidden])' )
.focus();
}
} );
}
} );
} )( jQuery );
/*
Thanks to these Stack Overflow answers for inspiration:
@neiker - https://stackoverflow.com/a/17150138/947370
@gdoron-is-supporting-monica https://stackoverflow.com/a/11278006/947370
@birgire https://wordpress.stackexchange.com/a/127042/41488
*/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.