From a7175db2799b1f75c995337cead3f08432f2e5d3 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 24 Sep 2012 16:25:15 +0000 Subject: [PATCH] Hitting return when adding a new category from the category meta box should add the new category, not submit the post form. props wojtek.szkutnik, fixes #14312. git-svn-id: https://develop.svn.wordpress.org/trunk@21970 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/post.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index 49aec1904a..459054e5a9 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -299,6 +299,13 @@ jQuery(document).ready( function($) { // Ajax Cat $('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); + + $('#new' + taxonomy).keypress( function(event){ + if( 13 === event.keyCode ) { + event.preventDefault(); + $('#' + taxonomy + '-add-submit').click(); + } + }); $('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); }); syncChecks = function() {